Release 4.1.1 #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
run-name: Release ${{ inputs.version }} | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
type: string | |
required: true | |
jobs: | |
build_and_test: | |
name: Build and test | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: Build and Test | |
run: | | |
npm ci | |
npm run test --if-present | |
npm run build --if-present | |
npm run build-exe --if-present | |
# - name: Check that build is clean | |
# run: | | |
# git diff --exit-code | |
validate_version: | |
name: Validate version number | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Process version number as SemVer | |
id: semver | |
uses: peter-murray/semver-data-action@v1 | |
with: | |
version: ${{ inputs.version }} | |
release: | |
name: Release | |
needs: | |
- validate_version | |
- build_and_test | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Process version number as SemVer | |
id: semver | |
uses: peter-murray/semver-data-action@v1 | |
with: | |
version: ${{ inputs.version }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set git user | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: Version application | |
run: | | |
npm version ${{ steps.semver.outputs.semver }} | |
- name: Build | |
run: | | |
npm ci | |
npm run build --if-present | |
npm run build-exe --if-present | |
- name: Check that build is clean | |
id: clean_build | |
continue-on-error: true | |
run: | | |
git diff --exit-code | |
- name: Update release | |
if: steps.clean_build.outcome == 'failure' | |
run: | | |
git add . | |
git commit -m "chore: Updating release files" | |
- name: Update tags | |
if: steps.semver.outputs.isPreRelease == 'false' | |
run: | | |
git tag "v${{ steps.semver.outputs.semver }}" --force | |
git tag "v${{ steps.semver.outputs.major }}" --force | |
git tag "v${{ steps.semver.outputs.major }}.${{ steps.semver.outputs.minor }}" --force | |
git tag "v${{ steps.semver.outputs.major }}.${{ steps.semver.outputs.minor }}.${{ steps.semver.outputs.patch }}" --force | |
git push origin ${{ github.ref_name }} | |
git push origin --tags --force | |
- name: Attach CLI artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cli | |
path: cli | |
- name: Create release | |
uses: ncipollo/[email protected] | |
with: | |
artifacts: cli/* | |
prerelease: ${{ steps.semver.outputs.isPreRelease }} | |
tag: v${{ steps.semver.outputs.semver }} |