Skip to content

Commit 96d2465

Browse files
committed
Revise release.yml to be a manual, checked workflow
1 parent ea5af8c commit 96d2465

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

.github/workflows/release.yml

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,54 @@
11
name: Build and Release
2+
23
on:
3-
push:
4-
branches:
5-
- main
4+
workflow_dispatch:
5+
inputs:
6+
npm-version-arg:
7+
description: Argument to npm-version
8+
default: minor
9+
required: true
610

711
jobs:
812
build:
913
name: Build
1014
runs-on: ubuntu-latest
1115
outputs:
12-
tag: ${{ steps.release_info.outputs.tag }}
16+
tag: ${{ steps.release_info.outputs.tag }}
1317
steps:
1418
- uses: actions/checkout@v2
1519
with:
1620
token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Configure git
23+
run: |
24+
git config user.name 'Release Action'
25+
git config user.email '<>'
26+
1727
- uses: actions/setup-node@v1
1828
with:
19-
node-version: '12'
20-
- name: Perform npm tasks
21-
run: npm run ci
29+
node-version: "12"
2230

23-
- name: Set release vars
24-
id: release_helpers
31+
- name: Update package version
32+
id: update-package-version
2533
run: |
26-
echo "::set-output name=commit::$(git rev-parse --short HEAD)"
27-
echo "::set-output name=package_version::$(node -e "console.log(require('./package.json').version);")"
34+
VERSION=$(npm version "${{ github.event.inputs.npm-version-arg }}")
35+
echo "::set-output name=version::$VERSION"
36+
37+
- name: Push new version
38+
run: git push
39+
40+
- name: Perform npm tasks
41+
run: npm run ci
2842

2943
- name: Commit to release branch
3044
id: release_info
3145
run: |
32-
git config user.name 'Build Action'
33-
git config user.email '<>'
34-
35-
TAG="v${{ steps.release_helpers.outputs.package_version }}"
46+
TAG="v${{ steps.update-package-version.outputs.version }}"
3647
BRANCH="release/$TAG"
3748
git switch -c $BRANCH
3849
git add --force dist lib
3950
40-
MESSAGE="Build for ${{ steps.release_helpers.outputs.commit }}"
51+
MESSAGE="Build for $(git rev-parse --short HEAD)"
4152
git commit --allow-empty -m "$MESSAGE"
4253
git tag -a -m "Release $TAG" $TAG
4354
git push origin $TAG

0 commit comments

Comments
 (0)