|
5 | 5 | tags: |
6 | 6 | - "*.*.*" |
7 | 7 | workflow_dispatch: |
| 8 | + |
8 | 9 | jobs: |
| 10 | + slack-start: |
| 11 | + uses: pgmac-net/pg-actions/.github/workflows/slack-notify-start.yml@main |
| 12 | + secrets: inherit |
| 13 | + |
9 | 14 | build-n-push: |
| 15 | + needs: [slack-start] |
10 | 16 | runs-on: self-hosted |
11 | 17 | steps: |
12 | | - - uses: actions/checkout@v3 |
13 | | - - name: Set the image version |
14 | | - id: vars |
15 | | - run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT |
16 | | - - name: Build the Docker image |
17 | | - run: docker build . --file Dockerfile --tag macro.int.pgmac.net:5000/gnutemps:${{ inputs.tags || steps.vars.outputs.tag }} |
18 | | - - name: Push to my internal registry |
19 | | - if: github.ref == 'refs/heads/"master"' |
20 | | - run: docker push macro.int.pgmac.net:5000/gnutemps:${{ inputs.tags || steps.vars.outputs.tag }} |
21 | | - - name: Exit code failure |
22 | | - if: failure() |
23 | | - run: | |
24 | | - echo "colour=danger" >> $GITHUB_ENV |
25 | | - echo "icon=🛑" >> $GITHUB_ENV |
26 | | - - name: Exit code cancelled |
27 | | - if: cancelled() |
28 | | - run: | |
29 | | - echo "colour=warning" >> $GITHUB_ENV |
30 | | - echo "icon=⚠" >> $GITHUB_ENV |
31 | | - - name: Exit code success |
32 | | - if: success() |
33 | | - run: | |
34 | | - echo "colour=good" >> $GITHUB_ENV |
35 | | - echo "icon=✅" >> $GITHUB_ENV |
| 18 | + - uses: actions/checkout@v3 |
| 19 | + - name: Set the image version |
| 20 | + id: vars |
| 21 | + run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT |
| 22 | + - name: Build the Docker image |
| 23 | + run: docker build . --file Dockerfile --tag macro.int.pgmac.net:5000/gnutemps:${{ inputs.tags || steps.vars.outputs.tag }} |
| 24 | + - name: Push to my internal registry |
| 25 | + if: github.ref == 'refs/heads/"master"' |
| 26 | + run: docker push macro.int.pgmac.net:5000/gnutemps:${{ inputs.tags || steps.vars.outputs.tag }} |
36 | 27 |
|
37 | | - - name: Send Slack message |
38 | | - uses: slackapi/slack-github-action@v1.23.0 |
39 | | - with: |
40 | | - payload: | |
41 | | - { |
42 | | - "channel": "builds", |
43 | | - "attachments": [ |
44 | | - { |
45 | | - "mrkdwn_in": ["text", "pretext"], |
46 | | - "fallback": ${{ toJSON(join(github.event.commits.*.message, '<br>') || ':point_right: Manually triggered') }}, |
47 | | - "color": "${{ env.colour || 'grey' }}", |
48 | | - "pretext": "${{ env.icon || '?' }} ${{ github.workflow }} (${{ github.ref_name }}) #${{ github.run_number }}", |
49 | | - "author_name": "${{ github.triggering_actor || github.actor }}", |
50 | | - "title": "${{ github.workflow }}", |
51 | | - "title_link": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", |
52 | | - "text": ${{ toJSON(join(github.event.commits.*.message, '\n') || ':point_right: Manually triggered') }} |
53 | | - }, |
54 | | - { |
55 | | - "blocks": [ |
56 | | - { |
57 | | - "type": "section", |
58 | | - "text": { |
59 | | - "type": "mrkdwn", |
60 | | - "text": "<${{ github.event.pull_request.html_url || github.event.head_commit.url || github.server_url }}|View commit>" |
61 | | - } |
62 | | - } |
63 | | - ] |
64 | | - } |
65 | | - ] |
66 | | - } |
67 | | - env: |
68 | | - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
69 | | - SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |
| 28 | + slack-end: |
| 29 | + if: always() |
| 30 | + needs: [slack-start, build-n-push] |
| 31 | + uses: pgmac-net/pg-actions/.github/workflows/slack-notify-end.yml@main |
| 32 | + with: |
| 33 | + ts: ${{ needs.slack-start.outputs.ts }} |
| 34 | + start: ${{ needs.slack-start.outputs.start }} |
| 35 | + startfmt: ${{ needs.slack-start.outputs.startfmt }} |
| 36 | + status: ${{ needs.build-n-push.result }} |
| 37 | + secrets: inherit |
0 commit comments