2025-02-27 22:42:28 +01:00
|
|
|
on:
|
|
|
|
push:
|
2025-05-19 17:29:58 +02:00
|
|
|
# branches:
|
2025-05-19 17:29:10 +02:00
|
|
|
# - develop
|
2025-02-27 22:42:28 +01:00
|
|
|
env:
|
2025-05-19 17:29:10 +02:00
|
|
|
# REGISTRY_IMAGE: ${{ vars.REGISTRY }}/${{ github.repository }}:${{ github.ref_name }}
|
|
|
|
REGISTRY_IMAGE: ${{ vars.REGISTRY }}/${{ github.repository }}:develop
|
2025-02-27 22:42:28 +01:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2025-05-19 15:13:34 +02:00
|
|
|
runs-on: docker
|
2025-05-19 17:33:01 +02:00
|
|
|
if: false
|
2025-05-19 15:19:01 +02:00
|
|
|
container:
|
|
|
|
image: forge.hornwitser.no/public/builder:r2025.5.2
|
2025-02-27 22:42:28 +01:00
|
|
|
steps:
|
2025-05-18 01:11:50 +02:00
|
|
|
-
|
2025-05-19 15:00:54 +02:00
|
|
|
name: Authenticate with registry
|
2025-05-18 01:11:50 +02:00
|
|
|
run: |
|
2025-05-19 15:00:54 +02:00
|
|
|
echo "${{ secrets.REGISTRY_TOKEN }}" | podman login ${{ vars.REGISTRY }} --username runner --password-stdin
|
2025-02-27 22:42:28 +01:00
|
|
|
-
|
|
|
|
name: Get commit info
|
|
|
|
id: info
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
tee -a ${GITHUB_OUTPUT} <<EOF
|
2025-05-19 15:00:54 +02:00
|
|
|
DEPLOY_IMAGE=${{ env.REGISTRY_IMAGE }}
|
2025-02-27 22:42:28 +01:00
|
|
|
DEPLOY_BRANCH=${{ github.ref_name }}
|
|
|
|
EOF
|
2025-05-18 17:53:42 +02:00
|
|
|
-
|
|
|
|
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: |
|
2025-05-19 15:00:54 +02:00
|
|
|
podman build --tag ${{ env.REGISTRY_IMAGE }} ${{ github.workspace }}
|
|
|
|
podman push ${{ env.REGISTRY_IMAGE }}
|
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-19 17:33:01 +02:00
|
|
|
#needs: build
|
2025-05-19 15:13:34 +02:00
|
|
|
runs-on: docker
|
2025-05-19 15:19:01 +02:00
|
|
|
container:
|
|
|
|
image: forge.hornwitser.no/public/builder:r2025.5.2
|
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 }}
|
2025-05-19 15:00:54 +02:00
|
|
|
# -
|
|
|
|
# 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: Restart deployment
|
2025-05-19 17:33:01 +02:00
|
|
|
#if: github.ref_name == 'develop'
|
2025-02-27 22:42:28 +01:00
|
|
|
run: |
|
2025-05-19 15:00:54 +02:00
|
|
|
curl \
|
2025-05-19 17:43:34 +02:00
|
|
|
-H "X-Secret: ${{ secrets.SERVICE_WEBHOOK_SECRET }}" \
|
2025-05-19 17:29:10 +02:00
|
|
|
-d action=restart \
|
|
|
|
-d service=schedule-demo \
|
|
|
|
"http://fulla.hz.hornwitser.no:9000/hooks/service"
|