From 4a9a8cec85efe7ecb24b711482a21b5555d9503a Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Mon, 19 May 2025 18:03:47 +0200 Subject: [PATCH] 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. --- .forgejo/workflows/build.yaml | 67 ++++++++++++----------------------- 1 file changed, 23 insertions(+), 44 deletions(-) diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index c3041be..2fb3a23 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -1,65 +1,44 @@ on: push: branches: - - master + - develop env: - REGISTRY: forgejo.sbox.hornwitser.no - REGISTRY_IMAGE: forgejo.sbox.hornwitser.no/furnavia/schedule-demo + REGISTRY_IMAGE: ${{ vars.REGISTRY }}/${{ github.repository }}:${{ github.ref_name }} jobs: build: runs-on: docker container: - image: forgejo.sbox.hornwitser.no/furnavia/builder:latest + image: forge.hornwitser.no/public/builder:r2025.5.2 steps: - - name: Authenticate - 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 + name: Authenticate with registry run: | - tee -a ${GITHUB_OUTPUT} < ~/.git-credentials + git clone --branch ${{ github.ref_name }} ${{ github.server_url }}/${{ github.repository }} ${{ github.workspace }} - name: Build and push - uses: docker/build-push-action@v6 - with: - push: true - tags: ${{ env.REGISTRY_IMAGE }}:latest - outputs: - DEPLOY_IMAGE: ${{ steps.info.outputs.DEPLOY_IMAGE }} - DEPLOY_BRANCH: ${{ steps.info.outputs.DEPLOY_BRANCH }} + shell: bash + run: | + podman build --tag ${{ env.REGISTRY_IMAGE }} ${{ github.workspace }} + podman push ${{ env.REGISTRY_IMAGE }} deploy: + if: github.ref_name == 'develop' runs-on: docker needs: build container: - image: forgejo.sbox.hornwitser.no/furnavia/builder:latest + image: forge.hornwitser.no/public/builder:r2025.5.2 steps: - - name: Check info + name: Restart deployment 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 + curl --silent \ + --header "X-Secret: ${{ secrets.SERVICE_WEBHOOK_SECRET }}" \ + --data action=restart \ + --data service=schedule-demo \ + "http://fulla.hz.hornwitser.no:9000/hooks/service"