Skip to content

fix: docker release builds (#3569) #1081

fix: docker release builds (#3569)

fix: docker release builds (#3569) #1081

Workflow file for this run

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
name: Automatically Build Release
jobs:
docker-shard:
name: Shard Docker Builds
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: cashapp/[email protected]
- id: set-matrix
run: echo "matrix=$(just list-docker-images | tr -d '\n' | jq -R -s -c 'split(" ")')" >> "$GITHUB_OUTPUT"
build-docker-images:
name: Build ${{ matrix.service }} Docker Image
needs: docker-shard
runs-on: ubuntu-latest
strategy:
matrix:
service: ${{ fromJson(needs.docker-shard.outputs.matrix) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Init Hermit
uses: cashapp/[email protected]
- name: Build Docker Image
run: |
just build-docker ${{ matrix.service }}
mkdir -p artifacts/ftl-${{ matrix.service }}
docker save -o artifacts/ftl-${{ matrix.service }}/ftl-${{ matrix.service }}.tar ftl0/ftl-${{ matrix.service }}:latest
- name: Temporarily save Docker image
uses: actions/upload-artifact@v4
with:
name: docker-${{ matrix.service }}-artifact
path: artifacts/ftl-${{ matrix.service }}
retention-days: 1
release-docker:
name: Release Docker Images
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: build-docker-images
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Init Hermit
uses: cashapp/[email protected]
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: docker-*-artifact
- name: Load Docker images
run: |
for tar in artifacts/docker-*/ftl-*.tar; do
docker load -i "$tar"
done
- name: Log in to Container registry
uses: docker/login-action@v3
with:
username: ftl0
password: ${{ secrets.FTL_DOCKER_PUSH_TOKEN }}
- name: Push Docker Images
run: |
version="$(git describe --tags --abbrev=0)"
for image in $(just list-docker-images); do
docker tag "ftl0/ftl-${image}:latest" "ftl0/ftl-${image}:${GITHUB_SHA}"
docker tag "ftl0/ftl-${image}:latest" "ftl0/ftl-${image}:${version}"
docker push -a "ftl0/ftl-${image}"
done
create-go-release:
name: Release Go Binaries
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Init Hermit
uses: cashapp/[email protected]
- name: Build Cache
uses: ./.github/actions/build-cache
- name: Build Console
run: just build-frontend
- name: Publish Go Binaries
run: |
just errtrace
just build ftl # Ensure all the prerequisites are built before we use goreleaser
just build-language-plugins
goreleaser release --skip=validate
env:
GITHUB_TOKEN: ${{ github.token }}
FTL_HOMEBREW_TOKEN: ${{ secrets.FTL_HOMEBREW_TOKEN }}
create-jvm-releases:
name: Release JVM Artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Init Hermit
uses: cashapp/[email protected]
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set Version
working-directory: ./jvm-runtime/ftl-runtime
run: mvn versions:set -DnewVersion="$(echo ${{ github.ref_name }} | sed s/v//)"
- name: Build, Test, and Deploy to Maven Central
working-directory: ./jvm-runtime/ftl-runtime
run: |
# Maven deploy lifecycle will build, run tests, verify, sign, and deploy
mvn \
deploy \
-P ossrh,release \
--batch-mode \
--settings .maven_settings.xml
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SIGN_KEY_PASS: ${{ secrets.GPG_SECRET_PASSPHRASE }}
SIGN_KEY: ${{ secrets.GPG_SECRET_KEY }}
hermit-release:
name: Release Hermit
runs-on: ubuntu-latest
needs: [create-go-release]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: TBD54566975/hermit-ftl
ref: "main"
token: ${{ secrets.FTL_HERMIT_AUTOVERSION }}
- name: Init Hermit
uses: cashapp/[email protected]
- name: Setup Git Config
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Auto-version
run: |
hermit manifest auto-version ftl.hcl --update-digests
- name: Commit and Push
run: |
git add ftl.hcl
git commit -m "Auto-versioned"
git push origin main
vscode-release:
name: Release VSCode Extension
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Init Hermit
uses: cashapp/[email protected]
- name: Publish
run: |
set -euo pipefail
version="$(git describe --tags --abbrev=0 | sed 's/^v//')"
echo "Publishing version $version"
jq --arg version "$version" '.version = $version' frontend/vscode/package.json > frontend/vscode/package.json.tmp
mv frontend/vscode/package.json.tmp frontend/vscode/package.json
just publish-extension
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
helm-release:
name: Release Helm Charts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: "Checkout Charts Repository"
with:
repository: "${{ github.repository_owner }}/ftl-charts"
token: "${{ secrets.FTL_CHARTS_TOKEN }}"
fetch-depth: 0
- name: Checkout FTL
uses: actions/checkout@v4
with:
fetch-depth: 0
path: .ftl
- name: Init Hermit
uses: cashapp/[email protected]
with:
working-directory: ".ftl"
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
git config pull.rebase true
- name: Sync Charts to Charts Repository
run: |
cd .ftl
version="$(git describe --tags --abbrev=0 | sed 's/v//')"
just chart set-version "$version"
cd ..
rm -rf charts/
cp -r .ftl/charts/ charts/
git add charts
git commit -a -m "Update charts"
git push