functions/.forgejo/workflows/functions.yml
Peter Kurfer 4ff9f8b383
All checks were successful
functions / build (blob-proxy) (push) Successful in 1m15s
functions / build (comics) (push) Successful in 1m40s
functions / image_refs (push) Successful in 9s
functions / deploy (push) Successful in 9s
fix(ci): checkout for image refs step
2025-01-21 18:00:53 +01:00

86 lines
2.3 KiB
YAML

name: functions
on:
- push
jobs:
build:
strategy:
fail-fast: true
matrix:
function:
- comics
- blob-proxy
runs-on: ubuntu-latest
steps:
- name: Setup `spin`
uses: fermyon/actions/spin/setup@v1
- name: Setup Go 1.23.x
uses: actions/setup-go@v5
with:
go-version: "1.23.x"
- name: Setup tinygo
uses: acifani/setup-tinygo@v2
with:
tinygo-version: "0.35.0"
install-binaryen: "false"
- name: Login to container registry
uses: docker/login-action@v3
with:
registry: code.icb4dc0.de
username: prskr
password: ${{ secrets.CONTAINER_REGISTRY_TOKEN }}
- name: Checkout
uses: actions/checkout@v4
- name: Build
run: |
spin registry push --build code.icb4dc0.de/infrastructure/functions/${{ matrix.function }}:${{ github.sha }}
working-directory: ${{ matrix.function }}
image_refs:
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Git config
run: |
git config --global user.email "ci@icb4dc0.de"
git config --global user.name "Forgejo Actions"
- name: Update image reference
run: |
for func in "comics", "blob-proxy":
do
kustomize edit set image "$func=code.icb4dc0.de/infrastructure/functions/$func:${{ github.sha }}";
done
git add kustomization.yaml
git commit -m "chore(deploy): update image references"
git push
working-directory: deploy
deploy:
runs-on: ubuntu-latest
needs:
- build
- image_refs
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Upsert Argo App
run: |
argocd app create functions -f deploy/argo-app.yaml --upsert --server argo-cd-argocd-server.argo-system.svc --auth-token ${{ secrets.ARGOCD_TOKEN }} --plaintext
- name: Deploy KubeSpin apps
run: |
argocd app sync functions --server argo-cd-argocd-server.argo-system.svc --auth-token ${{ secrets.ARGOCD_TOKEN }} --plaintext --assumeYes