-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (49 loc) · 1.55 KB
/
deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
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