owltide/.forgejo/workflows/build.yaml

78 lines
2.3 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 18:27:36 +02:00
image: forge.hornwitser.no/hornwitser/builder:test@sha256:bafd939950b383dd6aa9dfc33850c71ad70635c60ca1afd1bba65530cd095b0e
2025-02-27 22:42:28 +01:00
steps:
2025-05-18 01:11:50 +02:00
-
name: debug
shell: bash
run: |
apt info podman-docker
type docker
2025-02-27 22:42:28 +01:00
-
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: Checkout repository
run: |
git config --global credential.helper store
echo "https://runner:${{ secrets.GITHUB_TOKEN }}@$(echo "${{ github.server_url }}" | cut -b 9-)" > ~/.git-credentials
git clone --branch ${{ github.ref_name }} ${{ github.server_url }}/${{ github.repository }} ${{ github.workspace }}
2025-02-27 22:42:28 +01:00
-
name: Build and push
2025-05-18 17:47:12 +02:00
shell: bash
run: |
podman build --tag ${{ env.REGISTRY_IMAGE }}:latest ${{ github.workspace }}
2025-05-18 17:47:12 +02:00
podman push ${{ 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:
2025-05-18 18:07:03 +02:00
runs-on: debian
2025-02-27 22:42:28 +01:00
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