-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(other): 使用 self-hosted 作为 github runner #2291
- Loading branch information
Showing
23 changed files
with
68 additions
and
100 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
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,4 +1,4 @@ | ||
name: Commit Message Check | ||
name: Auto Create Release | ||
|
||
on: | ||
push: | ||
|
@@ -9,7 +9,7 @@ on: | |
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- id: checkout | ||
name: Checkout | ||
|
@@ -22,6 +22,18 @@ jobs: | |
file: 'helm-charts/bk-dbm/Chart.yaml' | ||
key-path: '["version"]' | ||
|
||
- id: create-temporary-tag | ||
name: Create temporary tag | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: 'refs/tags/v${{ steps.yaml-data.outputs.data }}', | ||
sha: context.sha | ||
}) | ||
- id: build-release-log | ||
name: Build release log | ||
uses: mikepenz/[email protected] | ||
|
@@ -33,40 +45,40 @@ jobs: | |
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- id: delete-temporary-tag | ||
name: Delete temporary tag | ||
uses: actions/github-script@v6 | ||
with: | ||
# 参考 https://octokit.github.io/rest.js/v18#git-delete-ref | ||
# 参考 https://github.com/actions/github-script | ||
script: | | ||
github.rest.git.deleteRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: 'tags/v${{ steps.yaml-data.outputs.data }}' | ||
}) | ||
- id: create-tag | ||
name: Create tag | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const tagName = '${{ steps.yaml-data.outputs.data }}'; | ||
const tagMessage = '${{ steps.build-release-log.outputs.changelog }}'; | ||
// Create a lightweight tag | ||
await github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: `refs/tags/${tagName}`, | ||
ref: 'refs/tags/${{ steps.yaml-data.outputs.data }}', | ||
sha: context.sha | ||
}); | ||
// Create a tag object | ||
const tagObject = await github.rest.git.createTag({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
tag: tagName, | ||
message: tagMessage, | ||
object: context.sha, | ||
type: 'commit' | ||
}); | ||
// Create a new release with the tag | ||
await github.rest.repos.createRelease({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
tag_name: tagName, | ||
name: tagName, | ||
body: tagMessage | ||
}); | ||
// Output the name of the created tag to use in other steps | ||
return tagName; | ||
- id: create-release | ||
name: Create release | ||
uses: actions/create-release@latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.yaml-data.outputs.data }} | ||
release_name: ${{ steps.yaml-data.outputs.data }} | ||
body: ${{ steps.build-release-log.outputs.changelog }} | ||
draft: false | ||
prerelease: true |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.