ci: developing release job #35
Workflow file for this run
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
name: ci | |
on: | |
push: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup go-task | |
run: | | |
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d | |
echo "${PWD}/bin" >> $GITHUB_PATH | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21.x' | |
- name: Setup protobuf | |
uses: arduino/setup-protoc@v2 | |
with: | |
version: "24.3" | |
- name: all ci steps | |
run: | | |
# Note: it is by design that we don't use the builder | |
task apis:bootstrap | |
task apis:generate | |
task apis:export | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: proto-include | |
# both datatrails-common-api protos & upstream ones under a single | |
# -I dir compatible location | |
path: exported/proto-include | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: swagger | |
path: exported/swagger | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: go-datatrails-common-api-gen | |
path: exported/go-datatrails-common-api-gen | |
release: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'release' }} | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: proto-include | |
path: exported/proto-include | |
- uses: actions/download-artifact@v3 | |
with: | |
name: swagger | |
path: exported/swagger | |
- uses: actions/download-artifact@v3 | |
with: | |
name: go-datatrails-common-api-gen | |
path: exported/go-datatrails-common-api-gen | |
- name: show directories | |
working-directory: exported/ | |
run: find . -type d | |
- name: Upload proto files | |
env: | |
GH_TOKEN: ${{ github.token }} | |
working-directory: exported | |
run: | | |
TAG="$(echo "${GITHUB_REF}" | grep tags | grep -o "[^/]*$" || true)" | |
# this test will fail if the event type is not 'published' | |
if [ -z "$TAG" ]; then | |
echo "::error ::This is not a tagged release" | |
exit 1 | |
fi | |
tar -czf proto-include.tar.gz proto-include | |
gh release upload $TAG proto-include.tar.gz | |
tar -czf swagger.tar.gz swagger | |
gh release upload $TAG swagger.tar.gz | |
tar -czf go-datatrails-common-api-gen.tar.gz go-datatrails-common-api-gen | |
gh release upload $TAG go-datatrails-common-api-gen.tar.gz |