Skip to content

Version Action (#76) #29

Version Action (#76)

Version Action (#76) #29

Workflow file for this run

name: Version and Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
versioning:
name: Versioning
runs-on: ubuntu-latest
outputs:
hasChangesets: ${{ steps.changesets.outputs.hasChangesets }}
version: ${{ steps.version.outputs.CURRENT_VERSION }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Install Dependencies
run: npm ci
- name: Create Release Pull Request
id: changesets
uses: changesets/action@v1
with:
commit: "Version Action"
title: "Version Action"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get current version
id: version
run: echo "CURRENT_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
release:
name: Release
runs-on: ubuntu-latest
needs: versioning
if: needs.versioning.outputs.hasChangesets == 'false'
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure git
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
- name: Setup Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Publish tags
id: publish
uses: ./.github/actions/publish
with:
version: ${{ needs.versioning.outputs.version }}
- name: Get release notes
id: notes
if: steps.publish.outputs.published == 'true'
uses: ./.github/actions/get-release-notes
with:
version: ${{ needs.versioning.outputs.version }}
changelog: ./CHANGELOG.md
- name: Create release
if: steps.notes.outputs.release_notes
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5
with:
body: ${{ steps.notes.outputs.release_notes }}
tag_name: v${{ needs.versioning.outputs.version }}