-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (155 loc) · 6.1 KB
/
schedule-release.yaml
File metadata and controls
177 lines (155 loc) · 6.1 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
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
---
name: "Release: Schedule"
on:
workflow_dispatch:
inputs:
dryRun:
description: "Only print changes, don't build or push"
required: false
default: false
type: boolean
schedule:
- cron: "0 0 * * 5"
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRY_RUN: ${{ github.event.inputs.dryRun }}
jobs:
generate-build-matrix:
name: Generate matrix for building images
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.updates.outputs.changes }}
images: ${{ steps.updates.outputs.images }}
steps:
- uses: actions/checkout@v3
with:
token: ${{ env.TOKEN }}
- name: Install tools
run: |
sudo apt-get update
sudo apt-get -y install moreutils jo
- name: Fetch new app versions
id: updates
run: ./.github/scripts/updates.sh
images-build:
name: Build and push images
runs-on: ubuntu-latest
needs: [generate-build-matrix]
if: |
always()
&& contains(needs.*.result, 'success')
&& !contains(needs.*.result, 'failure')
&& !cancelled()
&& needs.generate-build-matrix.outputs.matrix != '[]'
strategy:
matrix:
image: ${{ fromJson(needs.generate-build-matrix.outputs.matrix) }}
fail-fast: false
steps:
- name: Dry run summary
if: ${{ env.DRY_RUN == 'true' }}
run: |
echo "DRY RUN ENABLED – no images will be built or pushed"
echo "Matrix:"
echo '${{ needs.generate-build-matrix.outputs.matrix }}'
- name: Checkout
uses: actions/checkout@v3
- name: Extract build metadata
id: vars
uses: ./.github/actions/setup-vars
with:
app: ${{ matrix.image.app }}
channel: ${{ matrix.image.channel }}
- name: Validate metadata
uses: ./.github/actions/validate-cue
with:
app: ${{ matrix.image.app }}
- name: Build test image
if: ${{ env.DRY_RUN != 'true' }}
uses: ./.github/actions/build-test-image
with:
app: ${{ matrix.image.app }}
channel: ${{ matrix.image.channel }}
upstream_version: ${{ steps.vars.outputs.chan_upstream_version }}
dockerfile: ${{ steps.vars.outputs.chan_dockerfile }}
tag_testing: ${{ steps.vars.outputs.chan_tag_testing }}
public_token: ${{ secrets.PUBLIC_PACKAGES }}
- name: Run Goss tests
if: ${{ env.DRY_RUN != 'true' && steps.vars.outputs.chan_tests_enabled == 'true' }}
uses: ./.github/actions/run-goss-tests
with:
tag_testing: ${{ steps.vars.outputs.chan_tag_testing }}
goss_config: ${{ steps.vars.outputs.chan_goss_config }}
goss_args: ${{ steps.vars.outputs.chan_goss_args }}
- name: Build and push release image
if: ${{ env.DRY_RUN != 'true' }}
uses: ./.github/actions/build-release-image
with:
app: ${{ matrix.image.app }}
channel: ${{ matrix.image.channel }}
upstream_version: ${{ steps.vars.outputs.chan_upstream_version }}
dockerfile: ${{ steps.vars.outputs.chan_dockerfile }}
label_type: ${{ steps.vars.outputs.chan_label_type }}
build_date: ${{ steps.vars.outputs.chan_build_date }}
tag_rolling: ${{ steps.vars.outputs.chan_tag_rolling }}
tag_version: ${{ steps.vars.outputs.chan_tag_version }}
platforms: ${{ steps.vars.outputs.chan_platforms }}
token: ${{ secrets.GH_PAT }}
public_token: ${{ secrets.PUBLIC_PACKAGES }}
notify-success:
runs-on: ubuntu-latest
needs: [generate-build-matrix, images-build]
if: |
always()
&& contains(needs.*.result, 'success')
&& !contains(needs.*.result, 'failure')
&& !cancelled()
&& needs.generate-build-matrix.outputs.matrix != '[]'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Notify success
uses: ./.github/actions/notifications
with:
title: "Scheduled Release Complete"
tags: '${{ secrets.APPRISE_TAGS }}'
apprise_configuration: '${{ secrets.APPRISE_CONFIG }}'
gh_verification: '${{ secrets.GH_VERIFICATION }}'
body: |
✅ **Image Rebuilds Complete**
The following images were successfully rebuilt:
- ${{ join(fromJson(needs.generate-build-matrix.outputs.images || '[]'), '\n- ') }}
---
🕐 Triggered by automated schedule
📅 Date: ${{ github.event.head_commit.timestamp }}
🔗 Commit: [${{ github.event.head_commit.message }}](${{ github.event.head_commit.url }})
🔗 Workflow: [${{ github.workflow }}](${{ github.run_url }})
🔗 Repository: [${{ github.repository }}](${{ github.event.repository.html_url }})
notify-failure:
runs-on: ubuntu-latest
needs: [generate-build-matrix, images-build]
if: |
always()
&& contains(needs.*.result, 'failure')
&& !cancelled()
&& needs.generate-build-matrix.outputs.matrix != '[]'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Notify failure
uses: ./.github/actions/notifications
with:
title: "Scheduled Release Failed"
tags: '${{ secrets.APPRISE_TAGS }}'
apprise_configuration: '${{ secrets.APPRISE_CONFIG }}'
gh_verification: '${{ secrets.GH_VERIFICATION }}'
body: |
❌ **Image Rebuilds Failed**
The following images failed to rebuild:
- ${{ join(fromJson(needs.generate-build-matrix.outputs.images || '[]'), '\n- ') }}
---
🕐 Triggered by automated schedule
📅 Date: ${{ github.event.head_commit.timestamp }}
🔗 Commit: [${{ github.event.head_commit.message }}](${{ github.event.head_commit.url }})
🔗 Workflow: [${{ github.workflow }}](${{ github.run_url }})
🔗 Repository: [${{ github.repository }}](${{ github.event.repository.html_url }})