forked from canonical/powershell-snaps
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (67 loc) · 2.53 KB
/
Copy pathpowershell-preview.yaml
File metadata and controls
71 lines (67 loc) · 2.53 KB
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
name: powershell-preview
on:
push:
branches:
- main
paths:
- 'powershell-preview/**'
pull_request:
branches: main
paths:
- 'powershell-preview/**'
workflow_dispatch:
inputs:
scheduled-run:
description: 'Run as if triggered by schedule (enables notifications and publishing checks)'
required: false
type: boolean
default: false
jobs:
needs-store-publishing:
uses: ./.github/workflows/template-scheduler-needs-publishing.yaml
with:
release: 'preview'
enable-mattermost-notifications: ${{ inputs.scheduled-run || github.event_name != 'workflow_dispatch' }}
secrets:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
build:
uses: ./.github/workflows/template-build.yaml
with:
release: 'preview'
needs: needs-store-publishing
if: ${{ !((inputs.scheduled-run || github.event_name != 'workflow_dispatch') && needs.needs-store-publishing.outputs.needs-publishing == 'false') }}
test:
uses: ./.github/workflows/template-test.yaml
needs: build
with:
release: 'preview'
publish:
uses: ./.github/workflows/template-publish.yaml
needs: test
if: ${{ contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) && github.ref_name == 'main' }}
with:
release: 'preview'
secrets:
SNAP_STORE_TOKEN: ${{ secrets.SNAP_STORE_TOKEN }}
notify:
runs-on: ubuntu-latest
needs: [needs-store-publishing, build, test, publish]
if: always() && (needs.needs-store-publishing.result == 'failure' || needs.build.result == 'failure' || needs.test.result == 'failure' || needs.publish.result == 'failure')
steps:
- name: Notify Mattermost on failure
uses: mattermost/action-mattermost-notify@master
with:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_CHANNEL: powershell-notifications
TEXT: |
:x: **PowerShell Preview Snap Workflow Failed**
**Workflow:** ${{ github.workflow }}
**Repository:** ${{ github.repository }}
**Branch:** ${{ github.ref_name }}
**Triggered by:** ${{ github.actor }}
**Run:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
**Job Status:**
- Needs Publishing Check: ${{ needs.needs-store-publishing.result }}
- Build: ${{ needs.build.result }}
- Test: ${{ needs.test.result }}
- Publish: ${{ needs.publish.result }}