owltide/.forgejo/workflows/build.yaml

66 lines
1.7 KiB
YAML
Raw Normal View History

2025-02-27 22:42:28 +01:00
on:
push:
branches:
2025-05-18 00:46:20 +02:00
- test
2025-02-27 22:42:28 +01:00
env:
2025-05-18 00:46:20 +02:00
REGISTRY: forge.hornwitser.no
2025-05-18 00:47:50 +02:00
REGISTRY_IMAGE: forge.hornwitser.no/hornwitser/schedule-demo
2025-02-27 22:42:28 +01:00
jobs:
build:
2025-05-18 00:46:56 +02:00
runs-on: debian
2025-02-27 22:42:28 +01:00
container:
2025-05-18 00:47:50 +02:00
image: forge.hornwitser.no/hornwitser/builder:test
2025-02-27 22:42:28 +01:00
steps:
-
name: Authenticate
uses: docker/login-action@v3
with:
2025-05-18 00:46:20 +02:00
username: runner
2025-02-27 22:42:28 +01:00
password: ${{ secrets.REGISTRY_TOKEN }}
registry: ${{ env.REGISTRY }}
-
name: Get commit info
id: info
shell: bash
run: |
tee -a ${GITHUB_OUTPUT} <<EOF
DEPLOY_IMAGE=${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }}
DEPLOY_BRANCH=${{ github.ref_name }}
EOF
-
name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ env.REGISTRY_IMAGE }}:latest
2025-02-27 22:42:28 +01:00
outputs:
DEPLOY_IMAGE: ${{ steps.info.outputs.DEPLOY_IMAGE }}
DEPLOY_BRANCH: ${{ steps.info.outputs.DEPLOY_BRANCH }}
deploy:
runs-on: docker
needs: build
container:
2025-05-18 00:47:50 +02:00
image: forge.hornwitser.no/hornwitser/builder:test
2025-02-27 22:42:28 +01:00
steps:
-
name: Check info
run: |
echo DEPLOY_IMAGE=${{ needs.build.outputs.DEPLOY_IMAGE }}
echo DEPLOY_BRANCH=${{ needs.build.outputs.DEPLOY_BRANCH }}
-
name: Configure kubectl
run: |
mkdir -p ~/.kube
cat > ~/.kube/config <<"EOF"
${{ secrets.KUBECONFIG_CONTENT }}
EOF
kubectl config view
kubectl config use-context flux-sandbox
-
name: Deploy
run: |
kubectl rollout restart \
-n schedule-demo \
deployment website