1010 deployment :
1111 runs-on : ubuntu-latest
1212 strategy :
13+ fail-fast : false
1314 matrix :
1415 deploy-target : [user, provider, admin, lambda_auth, user_signup]
1516
2930 - name : Set AWS Profile
3031 run : |
3132 ACCOUNT_NAME=$(aws iam list-account-aliases --query "AccountAliases[0]" --output text)
32- echo "PROFILE=$ACCOUNT_NAME" >> $GITHUB_ENV
33+ echo "PROFILE=$ACCOUNT_NAME" >> " $GITHUB_ENV"
3334
3435 - name : Set up Python
3536 uses : actions/setup-python@v5
@@ -39,14 +40,15 @@ jobs:
3940 - name : Install Poetry
4041 run : |
4142 pip install poetry poetry-plugin-export
42- echo "$HOME/.local/bin" >> $GITHUB_PATH
43+ echo "$HOME/.local/bin" >> " $GITHUB_PATH"
4344
4445 - name : Install poetry dependencies
4546 run : poetry install
4647
4748 - name : Install make
4849 run : sudo apt install make
4950
51+
5052 - name : Deploy
5153 working-directory : ./deployment/oqtopus-dev
5254 env :
@@ -57,111 +59,23 @@ jobs:
5759
5860 - name : On Success
5961 if : ${{ success() }}
60- env :
61- SLACK_API_TOKEN : ${{ secrets.SLACK_API_TOKEN }}
6262 run : |
63- TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
64- RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
65- curl -s -o /dev/null -X POST https://slack.com/api/chat.postMessage \
66- -H "Content-Type: application/json" \
67- -H "Authorization: Bearer $SLACK_API_TOKEN" \
68- --data @- <<EOF
69- {
70- "channel": "${{ secrets.SLACK_CHANNEL_NAME }}",
71- "text": "✅ Deploy successful (${{ matrix.deploy-target }})",
72- "attachments": [
73- {
74- "color": "#00dd00",
75- "blocks": [
76- {
77- "type": "section",
78- "text": {
79- "type": "mrkdwn",
80- "text": "*Log*"
81- }
82- },
83- {
84- "type": "section",
85- "text": {
86- "type": "mrkdwn",
87- "text": "[${TIMESTAMP}] Deployed successfully!"
88- }
89- },
90- {
91- "type": "divider"
92- },
93- {
94- "type": "section",
95- "text": {
96- "type": "mrkdwn",
97- "text": "*Action*"
98- }
99- },
100- {
101- "type": "section",
102- "text": {
103- "type": "mrkdwn",
104- "text": "${RUN_URL}"
105- }
106- }
107- ]
108- }
109- ]
110- }
111- EOF
63+ echo "SUCCESS=1" >> "$GITHUB_ENV"
11264
11365 - name : On Failure
11466 if : ${{ failure() }}
67+ run : |
68+ echo "SUCCESS=0" >> "$GITHUB_ENV"
69+
70+ - name : On Exit
71+ if : ${{ always() }}
72+ run : |
73+ source .venv/bin/activate
74+ python3 ./scripts/build_slack_notification.py \
75+ --success="$SUCCESS" \
76+ --timestamp="$(date "+%Y-%m-%d %H:%M:%S")" \
77+ --run-url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
78+ --deploy-target="${{ matrix.deploy-target }}"
11579 env :
11680 SLACK_API_TOKEN : ${{ secrets.SLACK_API_TOKEN }}
117- run : |
118- TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
119- RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
120- MESSAGE=$(cat error.log)
121- curl -s -o /dev/null -X POST https://slack.com/api/chat.postMessage \
122- -H "Content-Type: application/json" \
123- -H "Authorization: Bearer $SLACK_API_TOKEN" \
124- --data @- <<EOF
125- {
126- "channel": "${{ secrets.SLACK_CHANNEL_NAME }}",
127- "text": "❌ Deploy failed (${{ matrix.deploy-target }})",
128- "attachments": [
129- {
130- "color": "#dd0000",
131- "blocks": [
132- {
133- "type": "section",
134- "text": {
135- "type": "mrkdwn",
136- "text": "*Log*"
137- }
138- },
139- {
140- "type": "section",
141- "text": {
142- "type": "mrkdwn",
143- "text": "[${TIMESTAMP}] Deploy failed!"
144- }
145- },
146- {
147- "type": "divider"
148- },
149- {
150- "type": "section",
151- "text": {
152- "type": "mrkdwn",
153- "text": "*Action*"
154- }
155- },
156- {
157- "type": "section",
158- "text": {
159- "type": "mrkdwn",
160- "text": "${RUN_URL}"
161- }
162- }
163- ]
164- }
165- ]
166- }
167- EOF
81+ SLACK_CHANNEL_NAME : ${{ secrets.SLACK_CHANNEL_NAME }}
0 commit comments