-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: create github release on tag (#212)
Adds a GitHub workflow to create a GitHub release (with uploaded artifacts) when a tag is pushed.
- Loading branch information
1 parent
64285be
commit a0235d2
Showing
4 changed files
with
105 additions
and
1 deletion.
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,46 @@ | ||
name: Create release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
env: | ||
GH_TAG: ${{github.ref_name}} | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build-release-binaries: | ||
name: Build Relase Binaries | ||
runs-on: ubuntu-latest | ||
steps: | ||
# https://github.com/actions/checkout | ||
- uses: actions/checkout@v4 | ||
# Build the binaries using the `build/artifacts.sh` script in the repo | ||
- name: Build Artifacts | ||
run: build/artifacts.sh $GH_TAG | ||
# https://github.com/marketplace/actions/upload-a-build-artifact | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: binaries | ||
path: bin/artifacts/ | ||
|
||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
needs: [build-release-binaries] | ||
steps: | ||
# https://github.com/actions/checkout | ||
- uses: actions/checkout@v4 | ||
# https://github.com/actions/download-artifact | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: binaries | ||
path: bin/artifacts/ | ||
- name: Create Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: build/release.sh $GH_TAG | ||
|
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,25 @@ | ||
# Building a Release | ||
|
||
## Git Tags | ||
|
||
Github workflows has been configured in such a way that simply pushing a tag will deploy a new version of Piko. | ||
|
||
``` | ||
git tag v<TAG> | ||
git push origin --tags | ||
``` | ||
|
||
This will kick off the "Release" workflow on Github. | ||
|
||
## Github Releases | ||
|
||
New releases may also be built using the Github GUI. From the releases page: | ||
|
||
1. Draft a new release | ||
1. Create your new tag under "Choose a tag", choosing "Create new tag <TAG> on publish" | ||
1. Create your release notes or choose "Generate release notes" | ||
1. Give your release a title. | ||
1. Click Publish. | ||
|
||
This will generate a new git tag with the tag you've created. It will run the github action to build the artifacts and will then overwrite the release with a new release which contains the binaries attached. | ||
|
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
if [ $# -ne 1 ]; then | ||
echo "No release tag name given. Failing" | ||
exit 1 | ||
fi | ||
|
||
|
||
if ! command -v gh 2>&1 >/dev/null | ||
then | ||
echo "Github CLI could not be found" | ||
exit 2 | ||
fi | ||
|
||
if gh release edit $1 --verify-tag ; | ||
then | ||
# Release exists, upload binaries | ||
gh release upload \ | ||
$1 \ | ||
bin/artifacts/* | ||
else | ||
gh release create \ | ||
$1 \ | ||
bin/artifacts/* \ | ||
--generate-notes | ||
fi | ||
|