@@ -13,48 +13,58 @@ jobs:
1313 name : Build
1414 runs-on : ubuntu-latest
1515 outputs :
16- tag : ${{ steps.release_info .outputs.tag }}
16+ tag : ${{ steps.update-package-version .outputs.version }}
1717 steps :
18+ # Configure runner with the right stuff
1819 - uses : actions/checkout@v2
1920 with :
2021 token : ${{ secrets.GITHUB_TOKEN }}
21-
2222 - name : Configure git
2323 run : |
2424 git config user.name 'Release Action'
2525 git config user.email '<>'
26-
2726 - uses : actions/setup-node@v1
2827 with :
2928 node-version : " 12"
3029
30+ # Call `npm version`. It increments the version and commits the changes.
31+ # We'll save the output (new version string) for use in the following
32+ # steps
3133 - name : Update package version
3234 id : update-package-version
3335 run : |
3436 VERSION=$(npm version "${{ github.event.inputs.npm-version-arg }}")
3537 echo "::set-output name=version::$VERSION"
3638
39+ # Update the branch with the new commit
3740 - name : Push new version
3841 run : git push
3942
43+ # Now carry on, business as usual
4044 - name : Perform npm tasks
4145 run : npm run ci
4246
47+ # Finally, create a detached commit containing the built artifacts and tag
48+ # it with the release. Note: the fact that the branch is locally updated
49+ # will not be relayed (pushed) to origin
4350 - name : Commit to release branch
4451 id : release_info
4552 run : |
46- TAG="v${{ steps.update-package-version.outputs.version }}"
47- BRANCH="release/$TAG"
48- git switch -c $BRANCH
53+ # Retrieve the previously created tag
54+ TAG="${{ steps.update-package-version.outputs.version }}"
55+
56+ # Add the built artifacts. Using --force because dist/lib should be in
57+ # .gitignore
4958 git add --force dist lib
5059
60+ # Make the commit
5161 MESSAGE="Build for $(git rev-parse --short HEAD)"
5262 git commit --allow-empty -m "$MESSAGE"
63+
64+ # Create an annotated tag and push it to origin
5365 git tag -a -m "Release $TAG" $TAG
5466 git push origin $TAG
5567
56- echo "::set-output name=tag::$TAG"
57-
5868 release :
5969 name : Release
6070 runs-on : ubuntu-latest
0 commit comments