This repository has been archived by the owner on Sep 6, 2024. It is now read-only.
generated from python-discord/code-jam-template
-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (58 loc) · 1.93 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
# Cancel already running workflows if new ones are scheduled
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
validation:
uses: ./.github/workflows/validation.yml
unit-tests:
uses: ./.github/workflows/unit-tests.yml
docker:
uses: ./.github/workflows/docker.yml
needs: [unit-tests, validation]
permissions:
packages: write
contents: read
id-token: write
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
# Produce a pull request payload artifact with various data about the
# pull-request event (such as the PR number, title, author, ...).
# This data is then be picked up by status-embed.yml action.
pr_artifact:
name: Produce Pull Request payload artifact
runs-on: ubuntu-latest
steps:
- name: Prepare Pull Request Payload artifact
id: prepare-artifact
if: always() && github.event_name == 'pull_request'
continue-on-error: true
run: cat $GITHUB_EVENT_PATH | jq '.pull_request' > pull_request_payload.json
- name: Upload a Build Artifact
if: always() && steps.prepare-artifact.outcome == 'success'
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: pull-request-payload
path: pull_request_payload.json