Rewrite deployment for forge.hornwitser.no
Replace docker with podman and kubernetes with the simple service webhook in the forgejo workflow to make this compatible with my new infrastructure.
This commit is contained in:
parent
399a4d2ca5
commit
4a9a8cec85
1 changed files with 23 additions and 44 deletions
|
@ -1,65 +1,44 @@
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- develop
|
||||||
env:
|
env:
|
||||||
REGISTRY: forgejo.sbox.hornwitser.no
|
REGISTRY_IMAGE: ${{ vars.REGISTRY }}/${{ github.repository }}:${{ github.ref_name }}
|
||||||
REGISTRY_IMAGE: forgejo.sbox.hornwitser.no/furnavia/schedule-demo
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image: forgejo.sbox.hornwitser.no/furnavia/builder:latest
|
image: forge.hornwitser.no/public/builder:r2025.5.2
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Authenticate
|
name: Authenticate with registry
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
-
|
|
||||||
name: Get commit info
|
|
||||||
id: info
|
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
tee -a ${GITHUB_OUTPUT} <<EOF
|
echo "${{ secrets.REGISTRY_TOKEN }}" | podman login ${{ vars.REGISTRY }} --username runner --password-stdin
|
||||||
DEPLOY_IMAGE=${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }}
|
-
|
||||||
DEPLOY_BRANCH=${{ github.ref_name }}
|
name: Checkout repository
|
||||||
EOF
|
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 }}
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v6
|
shell: bash
|
||||||
with:
|
run: |
|
||||||
push: true
|
podman build --tag ${{ env.REGISTRY_IMAGE }} ${{ github.workspace }}
|
||||||
tags: ${{ env.REGISTRY_IMAGE }}:latest
|
podman push ${{ env.REGISTRY_IMAGE }}
|
||||||
outputs:
|
|
||||||
DEPLOY_IMAGE: ${{ steps.info.outputs.DEPLOY_IMAGE }}
|
|
||||||
DEPLOY_BRANCH: ${{ steps.info.outputs.DEPLOY_BRANCH }}
|
|
||||||
deploy:
|
deploy:
|
||||||
|
if: github.ref_name == 'develop'
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
needs: build
|
needs: build
|
||||||
container:
|
container:
|
||||||
image: forgejo.sbox.hornwitser.no/furnavia/builder:latest
|
image: forge.hornwitser.no/public/builder:r2025.5.2
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Check info
|
name: Restart deployment
|
||||||
run: |
|
run: |
|
||||||
echo DEPLOY_IMAGE=${{ needs.build.outputs.DEPLOY_IMAGE }}
|
curl --silent \
|
||||||
echo DEPLOY_BRANCH=${{ needs.build.outputs.DEPLOY_BRANCH }}
|
--header "X-Secret: ${{ secrets.SERVICE_WEBHOOK_SECRET }}" \
|
||||||
-
|
--data action=restart \
|
||||||
name: Configure kubectl
|
--data service=schedule-demo \
|
||||||
run: |
|
"http://fulla.hz.hornwitser.no:9000/hooks/service"
|
||||||
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
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue