-
Notifications
You must be signed in to change notification settings - Fork 15
79 lines (73 loc) · 2.39 KB
/
deploy.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
68
69
70
71
72
73
74
75
76
77
78
79
name: deploy
on:
push:
branches: ["main", "migration"]
pull_request:
branches: ["main", "migration"]
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-latest
environment: check-${{matrix.environment}}
strategy:
matrix:
environment: ["staging", "firefoxci"]
env:
TASKCLUSTER_ROOT_URL: ${{vars.TASKCLUSTER_ROOT_URL}}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: pip
- name: Install dependencies
run: pip install -r requirements/test.txt
- name: Run checks
run: tc-admin check --environment ${{matrix.environment}}
apply:
if: github.event_name == 'push'
runs-on: ubuntu-latest
needs: check
environment: apply-${{matrix.environment}}
strategy:
matrix:
environment: ["staging", "firefoxci"]
env:
TASKCLUSTER_ROOT_URL: ${{vars.TASKCLUSTER_ROOT_URL}}
TASKCLUSTER_CLIENT_ID: ${{vars.TASKCLUSTER_CLIENT_ID}}
TASKCLUSTER_ACCESS_TOKEN: ${{secrets.TASKCLUSTER_ACCESS_TOKEN}}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: pip
- name: Install dependencies
run: pip install -r requirements/base.txt
- name: Deploy environment
run: tc-admin apply --environment ${{matrix.environment}}
notify:
if: github.event_name == 'push'
runs-on: ubuntu-latest
needs: [check, apply]
strategy:
matrix:
environment: ["staging", "firefoxci"]
steps:
- name: Notify Slack
if: always()
run: |
WORKFLOW_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
SLACK_MESSAGE="*${{ github.workflow }} ${{ github.repository }}* (<${WORKFLOW_URL}|View Workflow>)"
for JOB_NAME in check apply; do
JOB_STATUS="${{ needs[$JOB_NAME].result }}"
if [ "${JOB_STATUS}" == "success" ]; then
SLACK_MESSAGE="${SLACK_MESSAGE}\n:white_check_mark: *${JOB_NAME}*
else
SLACK_MESSAGE="${SLACK_MESSAGE}\n:x: *${JOB_NAME}*
fi
done
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"${SLACK_MESSAGE}\"}" ${{ secrets.SLACK_WEBHOOK_URL }}