Wip rework deployment
Some checks are pending
/ build (push) Waiting to run
/ deploy (push) Blocked by required conditions

This commit is contained in:
Hornwitser 2025-05-19 15:00:54 +02:00
parent f391cb3d93
commit 26f9e21083

View file

@ -1,37 +1,24 @@
on:
push:
branches:
- test
env:
REGISTRY: forge.hornwitser.no
REGISTRY_IMAGE: forge.hornwitser.no/hornwitser/schedule-demo
REGISTRY_IMAGE: ${{ vars.REGISTRY }}/${{ github.repository }}:${{ github.ref_name }}
jobs:
build:
runs-on: debian
container:
image: forge.hornwitser.no/public/builder:develop
image: forge.hornwitser.no/public/builder:r2025.5.2
steps:
-
name: debug
shell: bash
name: Authenticate with registry
run: |
apt info podman-docker
type docker
-
name: Authenticate
uses: docker/login-action@v3
with:
username: runner
password: ${{ secrets.REGISTRY_TOKEN }}
registry: ${{ env.REGISTRY }}
echo "${{ secrets.REGISTRY_TOKEN }}" | podman login ${{ vars.REGISTRY }} --username runner --password-stdin
-
name: Get commit info
id: info
shell: bash
run: |
tee -a ${GITHUB_OUTPUT} <<EOF
DEPLOY_IMAGE=${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }}
DEPLOY_IMAGE=${{ env.REGISTRY_IMAGE }}
DEPLOY_BRANCH=${{ github.ref_name }}
EOF
-
@ -44,34 +31,33 @@ jobs:
name: Build and push
shell: bash
run: |
podman build --tag ${{ env.REGISTRY_IMAGE }}:latest ${{ github.workspace }}
podman push ${{ env.REGISTRY_IMAGE }}:latest
podman build --tag ${{ env.REGISTRY_IMAGE }} ${{ github.workspace }}
podman push ${{ env.REGISTRY_IMAGE }}
outputs:
DEPLOY_IMAGE: ${{ steps.info.outputs.DEPLOY_IMAGE }}
DEPLOY_BRANCH: ${{ steps.info.outputs.DEPLOY_BRANCH }}
deploy:
runs-on: debian
needs: build
container:
image: forge.hornwitser.no/public/builder:develop
image: forge.hornwitser.no/public/builder:r2025.5.2
steps:
-
name: Check info
run: |
echo DEPLOY_IMAGE=${{ needs.build.outputs.DEPLOY_IMAGE }}
echo DEPLOY_BRANCH=${{ needs.build.outputs.DEPLOY_BRANCH }}
# -
# name: Checkout deploy repository
# run: |
# git config --global user.email runner@noreply.hornwitser.no
# git config --global user.name Runner
# git config --global credential.helper store
# echo "https://runner:${{ secrets.DEPLOY_TOKEN }}@$(echo "${{ github.server_url }}" | cut -b 9-)" > ~/.git-credentials
# git clone ${{ github.server_url }}/hornwitser/infra.git ${{ github.workspace }}
-
name: Configure kubectl
name: Restart deployment
if: github.ref_name == 'develop'
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
curl \
-H "Authorization: ${{ secrets.WEBHOOK_RESTART_TOKEN }}"
-X POST "http://fulla.hz.hornwitser.no:9000/hooks/restart?container=schedule-demo"