-
Notifications
You must be signed in to change notification settings - Fork 2
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
i.o.novikov
committed
Feb 22, 2022
1 parent
a2dc1ac
commit a8e56bb
Showing
1 changed file
with
65 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: "Release workflows" | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
|
||
jobs: | ||
Create-release-with-tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions-ecosystem/action-get-latest-tag@v1 | ||
id: get-latest-tag | ||
with: | ||
semver_only: true | ||
initial_version: 'v1.0.0' | ||
|
||
- uses: actions-ecosystem/action-bump-semver@v1 | ||
id: bump-semver | ||
with: | ||
current_version: ${{ steps.get-latest-tag.outputs.tag }} | ||
level: patch | ||
|
||
- uses: actions-ecosystem/action-push-tag@v1 | ||
with: | ||
tag: ${{ steps.bump-semver.outputs.new_version }} | ||
message: '${{ steps.bump-semver.outputs.new_version }}: PR #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}' | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
with: | ||
tag_name: ${{ steps.bump-semver.outputs.new_version }} | ||
release_name: Release ${{ steps.bump-semver.outputs.new_version }} | ||
draft: false | ||
prerelease: false | ||
|
||
- uses: actions-ecosystem/action-regex-match@v2 | ||
id: regex-match | ||
with: | ||
text: ${{ steps.bump-semver.outputs.new_version }} | ||
regex: '^v(\d+).' | ||
|
||
- name: Move major tag | ||
uses: actions/github-script@v3 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
try { | ||
await github.git.deleteRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: "tags/v${{ steps.regex-match.outputs.group1 }}" | ||
}) | ||
} catch (e) { | ||
console.log("The nightly tag doesn't exist yet: " + e) | ||
} | ||
await github.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: "refs/tags/v${{ steps.regex-match.outputs.group1 }}", | ||
sha: context.sha | ||
}) |