mirror of
https://github.com/ItsDrike/itsdrike.com.git
synced 2025-01-23 12:04:35 +00:00
Add continuous delivery to CI
This commit is contained in:
parent
2d81a23ae8
commit
2433048db0
20
.github/workflows/build-publish.yml
vendored
20
.github/workflows/build-publish.yml
vendored
|
@ -4,13 +4,14 @@ on:
|
|||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-publish:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
@ -78,3 +79,20 @@ jobs:
|
|||
ghcr.io/itsdrike/web:${{ steps.sha_tag.outputs.tag }}
|
||||
build-args: |
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue