v1.0.0-alpha.62 #72
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: Publish Release Artifacts | |
on: | |
release: | |
types: | |
# This triggers on both prerelease and release | |
- published | |
jobs: | |
publish-release-artifacts: | |
runs-on: ubuntu-latest | |
# based on: https://docs.github.com/en/actions/using-containerized-services/creating-postgresql-service-containers#running-jobs-directly-on-the-runner-machine | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get tag | |
run: | | |
echo "TAG=${GITHUB_REF#refs/*/}" >> "$GITHUB_ENV" | |
- uses: bufbuild/buf-setup-action@v1 | |
- name: Push to BSR | |
env: | |
BUF_TOKEN: ${{ secrets.BUF_TOKEN }} | |
# Due to this issue (https://github.com/bufbuild/buf/issues/1621) in buf, no tag is created if the proto files are not changed | |
# To keep the BSR tags in sync with our git repo, we manually add every tag | |
# Furthermore, the buf_dependency_version needs to be constructed from the latest commit that is tagged, as that's how the BSR SDK dependency versions are constructed | |
run: | | |
cd protos | |
buf_commit_hash_or_empty=$(buf push) | |
buf_commit_hash=$([[ ${buf_commit_hash_or_empty} = "" ]] && buf beta registry commit list --page-size 1 --reverse --format json buf.build/getstrm/pace:main | jq -r '.results[0].commit' || echo "$buf_commit_hash_or_empty") | |
buf beta registry tag create "buf.build/getstrm/pace:${buf_commit_hash}" ${{ env.TAG }} | |
buf_dependency_version=$(buf alpha sdk maven-version --module=buf.build/getstrm/pace:${{ env.TAG }} --plugin=buf.build/protocolbuffers/java:v24.4 | sed "s/24.4.0.1.//") | |
echo "BUF_DEPENDENCY_VERSION=${buf_dependency_version}" >> "$GITHUB_ENV" | |
- name: Generate JSON Schema | |
env: | |
BUF_TOKEN: ${{ secrets.BUF_TOKEN }} | |
run: | | |
cd protos | |
buf generate | |
- name: Copy JSON Schema | |
run: | | |
make copy-json-schema-to-resources | |
# JVM artifact | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- uses: gradle/actions/setup-gradle@v3 | |
- run: ./gradlew prepareForDocker -PciBuild -PgeneratedBufDependencyVersion=${{ env.BUF_DEPENDENCY_VERSION }} | |
- name: "Generate Proto Filedescriptor" | |
# Normally generated in the Gradle prepareForDocker step, but the ciBuild flag disables that | |
run: | | |
cd protos | |
mkdir -p ../server/build/docker | |
buf build -o ../server/build/docker/descriptor.binpb | |
# Container artifact | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
env: | |
BUILDX_NO_DEFAULT_ATTESTATIONS: 1 | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.BOT_USERNAME }} | |
password: ${{ secrets.GH_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: "ghcr.io/getstrm/pace" | |
tags: | | |
type=raw,value=latest | |
type=raw,value=latest-alpha | |
type=semver,pattern={{major}}.{{minor}}.{{patch}},value=${{ env.TAG }} | |
type=semver,pattern={{major}}.{{minor}},value=${{ env.TAG }} | |
type=semver,pattern={{major}},value=${{ env.TAG }} | |
type=sha | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: server/build/docker | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |