-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
15 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,60 @@ | ||
name: Release | ||
name: Tag and Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'release/*' | ||
- main | ||
- release/* | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
TagStage: | ||
name: Bump Git Tag with Semverbot | ||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
working-directory: ${{ github.workspace }} | ||
|
||
steps: | ||
- name: Checkout code | ||
- name: Checkout Source Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16' | ||
repository: ${{ github.repository }} | ||
ref: ${{ github.ref }} | ||
persist-credentials: true | ||
|
||
- name: Set up Git | ||
run: | | ||
git config --global user.name 'semverbot' | ||
git config --global user.email '[email protected]' | ||
- name: Bump Git Tag to Next Version | ||
run: | | ||
semverbot bump \ | ||
--working-directory "${{ github.workspace }}" \ | ||
--config-file "${{ github.workspace }}/template-repo/src/pipelines/shared/config/semverbot-config.toml" \ | ||
--branch "${{ github.ref_name }}" \ | ||
--git-user-email "[email protected]" \ | ||
--git-user-name "semverbot" | ||
- name: Install dependencies | ||
run: npm install | ||
- name: Add Current and Next Version Tags | ||
run: | | ||
echo "::set-output name=current_version::$(semverbot predict --current)" | ||
echo "::set-output name=next_version::$(semverbot predict --next)" | ||
- name: Push New Tag to Repository | ||
run: | | ||
git push origin --tags | ||
- name: Add Tags as Build Metadata | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const currentVersion = '${{ steps.BumpGitTag.outputs.current_version }}'; | ||
const nextVersion = '${{ steps.BumpGitTag.outputs.next_version }}'; | ||
- name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: npx semantic-release | ||
core.setOutput('current_version', currentVersion); | ||
core.setOutput('next_version', nextVersion); | ||
core.info(`Current version: ${currentVersion}`); | ||
core.info(`Next version: ${nextVersion}`); |