-
-
Notifications
You must be signed in to change notification settings - Fork 2
118 lines (113 loc) · 4.29 KB
/
cicd.yaml
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
---
name: CI/CD
on:
workflow_dispatch:
push:
branches:
- master
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release-please:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
prs_created: ${{ steps.release.outputs.prs_created }}
release_created: ${{ steps.release.outputs.release_created }}
major: ${{ steps.release.outputs.major }}
minor: ${{ steps.release.outputs.minor }}
patch: ${{ steps.release.outputs.patch }}
sha: ${{ steps.release.outputs.sha }}
steps:
- name: Automate releases based on conventional commits
id: release
uses: googleapis/release-please-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: configs/release-please-config.json
manifest-file: configs/release-please-manifest.json
- name: Format and print GH step summary
if: always()
run: |
echo "| Key | Value |" >> $GITHUB_STEP_SUMMARY
echo "|:--|:--|" >> $GITHUB_STEP_SUMMARY
echo "| **releases_created** | ${{ steps.release.outputs.releases_created }} |" >> $GITHUB_STEP_SUMMARY
echo "| **prs_created** | ${{ steps.release.outputs.prs_created }} |" >> $GITHUB_STEP_SUMMARY
- name: Format and print the release_created GH step summary
if: ${{ steps.release.outputs.release_created }}
run: |
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Key | Value |" >> $GITHUB_STEP_SUMMARY
echo "|:--|:--|" >> $GITHUB_STEP_SUMMARY
echo "| **release_created** | ${{ steps.release.outputs.release_created }} |" >> $GITHUB_STEP_SUMMARY
echo "| **major** | ${{ steps.release.outputs.major }} |" >> $GITHUB_STEP_SUMMARY
echo "| **minor** | ${{ steps.release.outputs.minor }} |" >> $GITHUB_STEP_SUMMARY
echo "| **patch** | ${{ steps.release.outputs.patch }} |" >> $GITHUB_STEP_SUMMARY
echo "| **sha** | ${{ steps.release.outputs.sha }} |" >> $GITHUB_STEP_SUMMARY
linter:
needs: release-please
runs-on: ubuntu-latest
outputs:
fallback: ${{ steps.fallback.outputs.changes }}
steps:
- name: Checkout default branch
uses: actions/checkout@v4
- name: Check compliance with guidelines
id: linter
run: ./linter.sh
- name: Check Containerfiles with hadolint
id: hadolint
uses: hadolint/[email protected]
with:
dockerfile: Containerfile
recursive: true
config: configs/hadolint.yaml
- name: Check update scripts fallback changes
id: fallback
uses: ./.github/actions/fallback-updates
- name: Format and print GH step summary
if: always()
run: |
echo "| Key | Value |" >> $GITHUB_STEP_SUMMARY
echo "|:--|:--|" >> $GITHUB_STEP_SUMMARY
echo "| **linter** | ${{ steps.linter.outputs.checks }} |" >> $GITHUB_STEP_SUMMARY
echo "| **hadolint** | ${{ steps.hadolint.outcome }} |" >> $GITHUB_STEP_SUMMARY
fallback-updates:
needs: linter
permissions:
contents: write
if: ${{ needs.linter.outputs.fallback && github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- name: Checkout default branch
uses: actions/checkout@v4
- name: Run update scripts as fallback and push any changes
id: fallback
uses: ./.github/actions/fallback-updates
with:
run_mode: push
- name: Format and print GH step summary
if: always()
run: |
echo "| Key | Value |" >> $GITHUB_STEP_SUMMARY
echo "|:--|:--|" >> $GITHUB_STEP_SUMMARY
echo "| **makefiles** | ${{ steps.fallback.outputs.makefiles }} |" >> $GITHUB_STEP_SUMMARY
echo "| **push** | ${{ steps.fallback.outputs.push || 'false' }} |" >> $GITHUB_STEP_SUMMARY
secops:
needs: [release-please, linter]
permissions:
contents: read
security-events: write
# private repos only
# actions: read
if: ${{ needs.release-please.outputs.release_created }}
uses: ./.github/workflows/secops.yaml