2025-01-17 10:30:27 +01:00
|
|
|
name: functions
|
|
|
|
|
|
|
|
on:
|
|
|
|
- push
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2025-01-21 16:33:58 +01:00
|
|
|
strategy:
|
|
|
|
fail-fast: true
|
|
|
|
matrix:
|
|
|
|
function:
|
|
|
|
- comics
|
|
|
|
- blob-proxy
|
2025-01-17 10:30:27 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2025-01-17 13:19:27 +01:00
|
|
|
- name: Setup Git config
|
|
|
|
run: |
|
|
|
|
git config --global user.email "ci@icb4dc0.de"
|
|
|
|
git config --global user.name "Forgejo Actions"
|
2025-01-21 16:33:58 +01:00
|
|
|
|
2025-01-17 10:30:27 +01:00
|
|
|
- name: Setup `spin`
|
|
|
|
uses: fermyon/actions/spin/setup@v1
|
|
|
|
|
2025-01-17 11:28:51 +01:00
|
|
|
- name: Setup Go 1.23.x
|
|
|
|
uses: actions/setup-go@v5
|
|
|
|
with:
|
|
|
|
go-version: "1.23.x"
|
|
|
|
|
2025-01-17 11:03:10 +01:00
|
|
|
- name: Setup tinygo
|
|
|
|
uses: acifani/setup-tinygo@v2
|
|
|
|
with:
|
|
|
|
tinygo-version: "0.35.0"
|
|
|
|
install-binaryen: "false"
|
|
|
|
|
2025-01-17 11:34:00 +01:00
|
|
|
- name: Login to container registry
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: code.icb4dc0.de
|
|
|
|
username: prskr
|
|
|
|
password: ${{ secrets.CONTAINER_REGISTRY_TOKEN }}
|
|
|
|
|
2025-01-17 10:30:27 +01:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: |
|
2025-01-21 16:33:58 +01:00
|
|
|
spin registry push --build code.icb4dc0.de/infrastructure/functions/${{ matrix.function }}:${{ github.sha }}
|
2025-01-17 10:30:27 +01:00
|
|
|
working-directory: comics
|
|
|
|
|
2025-01-17 13:06:57 +01:00
|
|
|
- name: Update image reference
|
|
|
|
run: |
|
2025-01-21 16:33:58 +01:00
|
|
|
kustomize edit set image ${{ matrix.function }}=code.icb4dc0.de/infrastructure/functions/${{ matrix.function }}:${{ github.sha }}
|
2025-01-17 13:06:57 +01:00
|
|
|
git add kustomization.yaml
|
2025-01-21 16:33:58 +01:00
|
|
|
git commit -m "chore(deploy): update ${{ matrix.function }} image reference"
|
2025-01-21 16:33:58 +01:00
|
|
|
git push || git pull --rebase && git push
|
2025-01-21 17:19:36 +01:00
|
|
|
working-directory: deploy
|
2025-01-17 13:06:57 +01:00
|
|
|
|
2025-01-21 16:33:58 +01:00
|
|
|
deploy:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- build
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
ref: ${{ github.ref_name }}
|
|
|
|
|
2025-01-17 11:38:50 +01:00
|
|
|
- name: Upsert Argo App
|
2025-01-17 11:48:31 +01:00
|
|
|
run: |
|
2025-01-17 11:54:46 +01:00
|
|
|
argocd app create functions -f deploy/argo-app.yaml --upsert --server argo-cd-argocd-server.argo-system.svc --auth-token ${{ secrets.ARGOCD_TOKEN }} --plaintext
|
2025-01-21 16:33:58 +01:00
|
|
|
|
2025-01-17 11:38:50 +01:00
|
|
|
- name: Deploy KubeSpin apps
|
2025-01-17 11:48:31 +01:00
|
|
|
run: |
|
|
|
|
argocd app sync functions --server argo-cd-argocd-server.argo-system.svc --auth-token ${{ secrets.ARGOCD_TOKEN }} --plaintext --assumeYes
|