Skip to content

Commit

Permalink
Updating version number and adding release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-murray authored Jan 12, 2024
1 parent eb1b04b commit f8fe527
Show file tree
Hide file tree
Showing 3 changed files with 222 additions and 99 deletions.
123 changes: 123 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
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
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 github-actions@github.com
- 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@v3
with:
name: cli
path: cli

- name: Create release
uses: ncipollo/release-action@v1.13.0
with:
artifacts: cli/*
prerelease: ${{ steps.semver.outputs.isPreRelease }}
tag: v${{ steps.semver.outputs.semver }}
Loading

0 comments on commit f8fe527

Please sign in to comment.