feat: auto-version via CI #30
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
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
name: Build Docker Images | |
jobs: | |
build-runner: | |
name: Build Runner Docker Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Init Hermit | |
uses: cashapp/activate-hermit@v1 | |
- name: Build | |
run: | | |
docker build -t ghcr.io/tbd54566975/ftl-runner:$GITHUB_SHA -t ghcr.io/tbd54566975/ftl-runner:latest -f Dockerfile.runner . | |
mkdir -p artifacts/ftl-runner | |
docker save -o artifacts/ftl-runner/ftl-runner.tar ghcr.io/tbd54566975/ftl-runner:latest | |
- name: Temporarily save Docker image | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docker-runner-artifact | |
path: artifacts/ftl-runner/ftl-runner.tar | |
retention-days: 1 | |
build-controller: | |
name: Build Controller Docker Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Init Hermit | |
uses: cashapp/activate-hermit@v1 | |
- name: Build | |
run: | | |
docker build -t ghcr.io/tbd54566975/ftl-controller:$GITHUB_SHA -t ghcr.io/tbd54566975/ftl-controller:latest -f Dockerfile.controller . | |
mkdir -p artifacts/ftl-controller | |
docker save -o artifacts/ftl-controller/ftl-controller.tar ghcr.io/tbd54566975/ftl-controller:latest | |
- name: Temporarily save Docker image | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docker-controller-artifact | |
path: artifacts/ftl-controller | |
retention-days: 1 | |
push-images: | |
name: Push Docker Images | |
runs-on: ubuntu-latest | |
needs: [build-runner, build-controller] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Init Hermit | |
uses: cashapp/activate-hermit@v1 | |
- name: Retrieve Runner Docker image | |
uses: actions/download-artifact@v3 | |
with: | |
name: docker-runner-artifact | |
path: artifacts/ftl-runner | |
- name: Retrieve Controller Docker image | |
uses: actions/download-artifact@v3 | |
with: | |
name: docker-controller-artifact | |
path: artifacts/ftl-controller | |
- name: Load Runner Docker image | |
run: docker load -i artifacts/ftl-runner/ftl-runner.tar | |
- name: Load Controller Docker image | |
run: docker load -i artifacts/ftl-controller/ftl-controller.tar | |
- name: Log in to the Container registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push | |
if: github.ref == 'refs/heads/main' | |
run: | | |
version=$(git describe --tags --abbrev=0) | |
docker tag ghcr.io/tbd54566975/ftl-runner:latest ghcr.io/tbd54566975/ftl-runner:$GITHUB_SHA ghcr.io/tbd54566975/ftl-runner:$version | |
docker push -a ghcr.io/tbd54566975/ftl-runner | |
docker tag ghcr.io/tbd54566975/ftl-controller:latest ghcr.io/tbd54566975/ftl-controller:$GITHUB_SHA ghcr.io/tbd54566975/ftl-controller:$version | |
docker push -a ghcr.io/tbd54566975/ftl-controller |