forked from salt-extensions/central-artifacts
-
Notifications
You must be signed in to change notification settings - Fork 0
152 lines (136 loc) · 4.07 KB
/
ci.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: CI
on:
workflow_call:
inputs:
setup-vault:
required: false
type: boolean
default: false
release:
required: false
type: boolean
default: false
version:
required: false
type: string
secrets:
PYPI_API_TOKEN:
required: false
TEST_PYPI_API_TOKEN:
required: false
jobs:
get-changed-files:
name: Get Changed Files
uses: salt-extensions/central-artifacts/.github/workflows/get-changed-files.yml@main
changed-files-debug:
name: Changed Files Debug Output
runs-on: ubuntu-latest
if: always()
needs:
- get-changed-files
steps:
- name: Echo Changed Files Output
run: echo "${{ toJSON(needs.get-changed-files.outputs.changed-files) }}"
azure-login:
name: Azure Login
runs-on: ubuntu-latest
steps:
- name: Set up Azure credentials
run: |
echo "Logging into Azure..."
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
az account set --subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }}
azure-login2:
runs-on: ubuntu-latest
steps:
- name: 'Az CLI login'
uses: Azure/login@v1
with:
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'
- name: Azure CLI script
uses: azure/CLI@v1
with:
azcliversion: latest
inlineScript: |
az account show
pre-commit:
name: Pre-Commit
uses: salt-extensions/central-artifacts/.github/workflows/pre-commit-action.yml@main
needs:
- get-changed-files
with:
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
test:
name: Test
needs:
- pre-commit
uses: salt-extensions/central-artifacts/.github/workflows/test-action.yml@main
with:
setup-vault: ${{ inputs.setup-vault }}
docs:
name: Docs
needs:
- pre-commit
uses: salt-extensions/central-artifacts/.github/workflows/docs-action.yml@main
build-python-package:
name: Python Package
if: ${{ inputs.release && success() }}
uses: salt-extensions/central-artifacts/.github/workflows/package-action.yml@main
needs:
- pre-commit
with:
version: "${{ inputs.version }}"
deploy-python-package-test-pypi:
name: Deploy Python Package (Test PyPI)
uses: salt-extensions/central-artifacts/.github/workflows/deploy-package-action.yml@main
if: ${{ inputs.release && success() }}
needs:
- test
- docs
- build-python-package
secrets: inherit
with:
version: "${{ inputs.version }}"
deploy-python-package:
name: Deploy Python Package (PyPI)
uses: salt-extensions/central-artifacts/.github/workflows/deploy-package-action.yml@main
if: ${{ inputs.release && success() }}
needs:
- deploy-python-package-test-pypi
secrets: inherit
with:
test: false
version: "${{ inputs.version }}"
set-pipeline-exit-status:
# This step is just so we can make github require this step, to pass checks
# on a pull request instead of requiring all
name: Set the CI Pipeline Exit Status
runs-on: ubuntu-latest
if: always()
needs:
- test
- docs
- build-python-package
- deploy-python-package-test-pypi
- deploy-python-package
steps:
- name: Download Exit Status Files
if: always()
uses: actions/download-artifact@v3
with:
name: exitstatus
path: exitstatus
- name: Delete Exit Status Artifacts
if: always()
uses: geekyeggo/delete-artifact@v2
with:
name: exitstatus
failOnError: false
- name: Set Pipeline Exit Status
run: |
tree exitstatus
grep -RE 'failure|cancelled' exitstatus/ && exit 1 || exit 0
- name: Done
if: always()
run:
echo "All workflows finished"