Add continuous delivery to CI

This commit is contained in:
ItsDrike 2024-09-06 22:45:07 +02:00
parent 2d81a23ae8
commit 2433048db0
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0

View file

@ -4,13 +4,14 @@ on:
push: push:
branches: branches:
- main - main
workflow_dispatch:
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
build-publish: docker:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -78,3 +79,20 @@ jobs:
ghcr.io/itsdrike/web:${{ steps.sha_tag.outputs.tag }} ghcr.io/itsdrike/web:${{ steps.sha_tag.outputs.tag }}
build-args: | build-args: |
git_sha=${{ github.sha }} git_sha=${{ github.sha }}
deploy-portainer:
runs-on: ubuntu-latest
needs: [docker]
env:
WEBHOOK: ${{ secrets.PORTAINER_WEBHOOK }}
if: (github.event_name == 'push' || github.event == 'workflow_dispatch') && github.ref == 'refs/heads/main'
steps:
- name: Trigger Portainer Webhook
if: env.WEBHOOK != ''
run: |
response=$(curl -s -X POST -o /dev/null -w "%{http_code}" ${{ secrets.PORTAINER_WEBHOOK }})
if [[ "$response" -lt 200 || "$response" -ge 300 ]]; then
echo "Webhook trigger failed with response code $response"
exit 1
fi