Skip to content

Deploy

Deploy #48

Workflow file for this run

---
name: Deploy
on:
workflow_run:
workflows:
- Build
branches:
- main
types:
- completed
env:
OCI_REPO: oci://ghcr.io/${{ github.actor }}/${{ github.event.repository.name }}
jobs:
deploy:
name: Production
environment: prod
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-24.04
steps:
- name: Download manifests archive
uses: actions/download-artifact@v4
with:
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Detect artifact dir and version
id: artifact
run: |
dir="$(ls -1d manifests-*)"
echo "dir=${dir}" >> "$GITHUB_OUTPUT"
echo "version=${dir/manifests-/}" >> "$GITHUB_OUTPUT"
- name: Install Flux
uses: fluxcd/flux2/action@main
- name: Sign in to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
# Token is set explicitly for the prod environment only.
password: ${{ secrets.GHCR_TOKEN }}
- name: Push Kubernetes manifests
run: |
flux push artifact "$OCI_REPO:${{ steps.artifact.outputs.version }}" \
--path="${{ steps.artifact.outputs.dir }}" \
--source="${{ github.repositoryUrl }}" \
--revision="${{ github.ref_name }}@sha1:${{ github.sha }}" \
--reproducible
- name: Deploy Kubernetes manifests to prod
run: |
flux tag artifact $OCI_REPO:${{ steps.artifact.outputs.version }} --tag latest