Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Publish

on:
push:
tags:
- "*-*"

jobs:
rust:
uses: ./.github/workflows/rust.yml

publish:
needs: rust
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Parse tag
id: tag
shell: bash
run: |
TAG="${GITHUB_REF_NAME}"
if [[ ! "$TAG" =~ ^([a-zA-Z0-9_.-]+)-([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
echo "Tag '$TAG' does not match <service>-<version> with version 1.2.3"
exit 1
fi
SERVICE="${BASH_REMATCH[1]}"
VERSION="${BASH_REMATCH[2]}.${BASH_REMATCH[3]}.${BASH_REMATCH[4]}"
echo "service=$SERVICE" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Auth to Google Cloud (WIF)
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}

- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v2

- name: Publish
run: ./publish.sh "${{ steps.tag.outputs.service }}" "${{ steps.tag.outputs.version }}"

- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
generate_release_notes: true
Loading