ci(release): trigger container build and portainer webhook for specific projects and branches

This commit is contained in:
Palm
2024-07-14 09:57:09 +00:00
committed by PalmDevs
parent a4e357c1ef
commit a20f8345b7
10 changed files with 81 additions and 63 deletions

View File

@@ -53,22 +53,10 @@ jobs:
DOCKER_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
WEBSOCKET_API_PORTAINER_WEBHOOK_URL: ${{ secrets.WEBSOCKET_API_PORTAINER_WEBHOOK_URL }}
DISCORD_BOT_PORTAINER_WEBHOOK_URL: ${{ secrets.DISCORD_BOT_PORTAINER_WEBHOOK_URL }}
run: bunx multi-semantic-release
- name: Set Portainer stack webhook URL based on branch
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
PORTAINER_WEBHOOK_URL=${{ secrets.PORTAINER_WEBHOOK_MAIN_URL }}
else
PORTAINER_WEBHOOK_URL=${{ secrets.PORTAINER_WEBHOOK_DEV_URL }}
fi
echo "PORTAINER_WEBHOOK_URL=$PORTAINER_WEBHOOK_URL" >> $GITHUB_ENV
- name: Trigger Portainer stack update
uses: newarifrh/portainer-service-webhook@v1
with:
webhook_url: ${{ env.PORTAINER_WEBHOOK_URL }}
- name: Purge outdated images
uses: snok/container-retention-policy@v3.0.0
with: