-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): Add release-please for release-automation
- Loading branch information
Showing
6 changed files
with
177 additions
and
51 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,89 @@ | ||
on: | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
build-binaries: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/create-github-app-token@v1 | ||
id: app-token | ||
with: | ||
app-id: ${{ secrets.TANKABOT_APP_ID }} | ||
private-key: ${{ secrets.TANKABOT_APP_PRIVATE_KEY }} | ||
|
||
# At first we should wait for a release to be created by the | ||
# release-please workflow | ||
- name: Check for release | ||
id: lookup-release | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const timers = require('node:timers/promises'); | ||
const ref = context.ref; | ||
if (!ref.startsWith('refs/tags/')) { | ||
core.setFailed('Not a valid ref'); | ||
return; | ||
} | ||
const currentTag = ref.substring('refs/tags/'.length); | ||
core.info(`Looking for release associated with '${currentTag}'`); | ||
let remainingAttempts = 6; | ||
while (remainingAttempts > 0) { | ||
try { | ||
const release = await github.rest.repos.getReleaseByTag({owner: context.repo.owner, repo: context.repo.repo, tag: currentTag}); | ||
core.info(`Release found: ${release.data.id}'`); | ||
core.setOutput('release_id', release.data.id); | ||
return; | ||
} catch (e) { | ||
if (remainingAttempts === 1) { | ||
if (e.status !== 404) { | ||
console.log(e); | ||
} | ||
} | ||
remainingAttempts -= 1; | ||
await timers.setTimeout(10000); | ||
} | ||
} | ||
core.setFailed('Release not found'); | ||
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | ||
with: | ||
# https://github.com/actions/checkout/issues/1467 | ||
fetch-depth: 0 | ||
|
||
- uses: ./.github/actions/setup-goversion | ||
|
||
- name: Build binaries | ||
run: make cross | ||
|
||
- name: Attach binaries | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ steps.app-token.outputs.token }} | ||
script: | | ||
const path = require('node:path'); | ||
const fs = require('node:fs/promises'); | ||
const releaseId = '${{ steps.lookup-release.outputs.release_id }}'; | ||
const globber = await glob.create('dist/*'); | ||
for await (const file of globber.globGenerator()) { | ||
const filename = path.basename(file); | ||
try { | ||
await github.rest.repos.uploadReleaseAsset({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
release_id: releaseId, | ||
name: filename, | ||
data: await fs.readFile(file), | ||
}); | ||
} catch (e) { | ||
if (e.status === 422) { | ||
core.setFailed(`${filename} already attached to release`); | ||
return; | ||
} | ||
throw e; | ||
} | ||
} | ||
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,26 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
name: release-please | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/create-github-app-token@v1 | ||
id: app-token | ||
with: | ||
app-id: ${{ secrets.TANKABOT_APP_ID }} | ||
private-key: ${{ secrets.TANKABOT_APP_PRIVATE_KEY }} | ||
|
||
- uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4.1.3 | ||
with: | ||
config-file: .release-please.json | ||
manifest-file: .release-please-manifest.json | ||
github-token: ${{ steps.app-token.outputs.token }} |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
{".": "0.28.3"} |
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,60 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", | ||
"changelog-sections": [ | ||
{ | ||
"section": "🎉 Features", | ||
"type": "feat" | ||
}, | ||
{ | ||
"section": "🐛 Bug Fixes", | ||
"type": "fix" | ||
}, | ||
{ | ||
"section": "⚡ Performance Improvements", | ||
"type": "perf" | ||
}, | ||
{ | ||
"section": "🔗 Dependencies", | ||
"type": "deps" | ||
}, | ||
{ | ||
"section": "📝 Documentation", | ||
"type": "docs" | ||
}, | ||
{ | ||
"section": "🏗️ Build System", | ||
"type": "build" | ||
}, | ||
{ | ||
"section": "🤖 Continuous Integration", | ||
"type": "ci" | ||
}, | ||
{ | ||
"section": "🔧 Miscellaneous Chores", | ||
"type": "chore" | ||
}, | ||
{ | ||
"section": "⏪ Reverts", | ||
"type": "revert" | ||
}, | ||
{ | ||
"section": "✅ Tests", | ||
"type": "test" | ||
}, | ||
{ | ||
"section": "💄 Style", | ||
"type": "style" | ||
}, | ||
{ | ||
"section": "♻️ Code Refactoring", | ||
"type": "refactor" | ||
} | ||
], | ||
"draft-pull-request": true, | ||
"include-v-in-tag": true, | ||
"packages": { | ||
".": { | ||
} | ||
}, | ||
"release-type": "go" | ||
} |
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