Skip to content

Bridge Release

Bridge Release #110

name: Bridge Release
on:
workflow_dispatch:
workflow_call:
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
id-token: write
packages: write
jobs:
get-version:
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
filter: tree:0
- id: get-version-number
run: |
version=$(cargo metadata --format-version 1 \
| jq -r '.packages[] | select(.name == "svix-bridge") | .version')
if ! [[ "$version" =~ ^[0-9.]+$ ]] ; then
echo >&2 "Invalid version $version"
exit 1
fi
echo "version=v${version}" >> "$GITHUB_OUTPUT"
working-directory: bridge
outputs:
version: ${{ steps.get-version-number.outputs.version }}
build:
needs: [get-version]
uses: docker/github-builder/.github/workflows/build.yml@27ade872c1e2296e62ef15ab3b10d37665e57cf7 # v1.15.0
permissions:
contents: read # to fetch the repository content
id-token: write # for signing attestation(s) with GitHub OIDC Token
packages: write # to push to ghcr
with:
output: image
file: bridge/Dockerfile
context: ./
push: true
platforms: linux/amd64,linux/arm64
cache: true
cache-scope: svix-bridge-release
cache-mode: max
meta-images: ghcr.io/svix/svix-bridge-staging
meta-flavor: |
latest=true
meta-tags: |
type=semver,pattern={{version}},prefix=v,value=${{ needs.get-version.outputs.version }}
type=semver,pattern={{major}}.{{minor}},prefix=v,value=${{ needs.get-version.outputs.version }}
type=semver,pattern={{major}},prefix=v,value=${{ needs.get-version.outputs.version }}
set-meta-labels: true
labels: |
org.opencontainers.image.version=${{ needs.get-version.outputs.version }}
org.opencontainers.image.revision=${{ github.sha }}
secrets:
registry-auths: |
- registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
release-to-dockerhub:
environment: release
needs: [get-version, build]
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install regctl
uses: iarekylew00t/regctl-installer@70686e10f8f949b24d6158e898a89cf21c3ac59c # v4.0.14
- name: Log in to GHCR
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Recompute meta tags
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: ghcr.io/svix/svix-bridge-staging
sep-tags: " "
flavor: |
latest=true
tags: |
type=semver,pattern={{version}},prefix=v,value=${{ needs.get-version.outputs.version }}
type=semver,pattern={{major}}.{{minor}},prefix=v,value=${{ needs.get-version.outputs.version }}
type=semver,pattern={{major}},prefix=v,value=${{ needs.get-version.outputs.version }}
- name: "Copy images"
run: |
for source in ${{ steps.meta.outputs.tags }}; do
# shellcheck disable=SC2001
dest="$(echo "$source" | sed -e 's,ghcr.io/svix/svix-bridge-staging,docker.io/svix/svix-bridge,')"
echo "Copying $source to $dest"
regctl image copy "$source" "$dest"
done