owltide/.forgejo/workflows/build.yaml

45 lines
1.4 KiB
YAML
Raw Normal View History

2025-02-27 22:42:28 +01:00
on:
push:
branches:
- develop
2025-02-27 22:42:28 +01:00
env:
REGISTRY_IMAGE: ${{ vars.REGISTRY }}/private/schedule-demo:${{ github.ref_name }}
2025-02-27 22:42:28 +01:00
jobs:
build:
runs-on: docker
container:
image: forge.hornwitser.no/public/builder:r2025.5.2
2025-02-27 22:42:28 +01:00
steps:
-
name: Authenticate with registry
run: |
echo "${{ secrets.REGISTRY_TOKEN }}" | podman login ${{ vars.REGISTRY }} --username runner --password-stdin
2025-02-27 22:42:28 +01:00
-
name: Checkout repository
2025-02-27 22:42:28 +01:00
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
shell: bash
run: |
podman build --tag ${{ env.REGISTRY_IMAGE }} ${{ github.workspace }}
podman push ${{ env.REGISTRY_IMAGE }}
2025-02-27 22:42:28 +01:00
deploy:
if: github.ref_name == 'develop'
2025-02-27 22:42:28 +01:00
runs-on: docker
needs: build
container:
image: forge.hornwitser.no/public/builder:r2025.5.2
2025-02-27 22:42:28 +01:00
steps:
-
name: Restart deployment
2025-02-27 22:42:28 +01:00
run: |
curl --silent \
--header "X-Secret: ${{ secrets.SERVICE_WEBHOOK_SECRET }}" \
--data action=restart \
--data service=schedule-demo \
"http://fulla.hz.hornwitser.no:9000/hooks/service"