Skip to content

Commit fac313e

Browse files
committed
chore: upgrade to latest workflows
1 parent ee49473 commit fac313e

5 files changed

Lines changed: 107 additions & 34 deletions

File tree

.github/workflows/docker.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: docker
22
run-name: ${{ inputs.run-name }}
33

4+
env:
5+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
6+
47
on:
58
workflow_dispatch:
69
inputs:
@@ -52,13 +55,13 @@ jobs:
5255
steps:
5356
# CHECKOUT REPOSITORY
5457
- name: init / checkout
55-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
58+
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v6.0.2
5659
with:
5760
ref: ${{ github.ref_name }}
5861

5962
- name: matrix / setup list
6063
id: setup-matrix
61-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
64+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
6265
with:
6366
script: |
6467
const { existsSync, readFileSync } = require('node:fs');
@@ -152,15 +155,15 @@ jobs:
152155
# ╚═════════════════════════════════════════════════════╝
153156
# CHECKOUT ALL DEPTHS (ALL TAGS)
154157
- name: init / checkout
155-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
158+
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v6.0.2
156159
with:
157160
ref: ${{ github.ref_name }}
158161
fetch-depth: 0
159162

160163
# SETUP ENVIRONMENT VARIABLES AND INPUTS
161164
- name: init / setup environment
162165
id: setup-environment
163-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
166+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
164167
with:
165168
script: |
166169
const { existsSync, readFileSync } = require('node:fs');
@@ -228,6 +231,20 @@ jobs:
228231
merge_tags:[],
229232
};
230233
234+
try{
235+
const response = await fetch('https://raw.githubusercontent.com/11notes/static/refs/heads/master/src/semver/latest.json');
236+
if(!response.ok){
237+
throw new Error(`error fetching OpenSSL version: ${response.status}`);
238+
}
239+
const result = await response.json();
240+
for(const dep in result){
241+
docker.app[`${dep}_version`] = `${result[dep]}`;
242+
core.info(`setting APP_${String(dep).toUpperCase()}_VERSION to ${result[dep]}`);
243+
}
244+
}catch(e){
245+
core.warning(e);
246+
}
247+
231248
docker.cache.name = `${docker.image.name}:${docker.image.prefix}buildcache${docker.image.suffix}`;
232249
docker.cache.grype = `${docker.cache.registry}${docker.image.name}:${docker.image.prefix}grype${docker.image.suffix}`;
233250
docker.app.prefix = docker.image.prefix;
@@ -600,7 +617,7 @@ jobs:
600617
# ╚═════════════════════════════════════════════════════╝
601618
# CHECKOUT ALL DEPTHS (ALL TAGS)
602619
- name: init / checkout
603-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
620+
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v6.0.2
604621
with:
605622
ref: master
606623
fetch-depth: 0

.github/workflows/org.build.yml

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,56 @@
11
name: org.build
22

3+
env:
4+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
5+
36
on:
47
workflow_dispatch:
58
inputs:
69
ref:
710
description: 'reference'
811
required: true
12+
913
etc:
1014
description: 'base64 encoded json string'
1115
required: false
1216
default: 'null'
1317

18+
release:
19+
description: 'create a release'
20+
required: false
21+
default: 'true'
22+
23+
readme:
24+
description: 'create a readme'
25+
required: false
26+
default: 'true'
27+
1428
jobs:
1529
build:
1630
runs-on: ubuntu-latest
1731
steps:
1832
# check if additional builds need to happen
1933
- name: etc to environment variable
2034
if: github.event.inputs.etc != 'null'
21-
uses: actions/github-script@62c3794a3eb6788d9a2a72b219504732c0c9a298
35+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
2236
with:
2337
script: |
2438
const { Buffer } = require('node:buffer');
2539
2640
(async()=>{
2741
try{
2842
const etc = JSON.parse(Buffer.from('${{ github.event.inputs.etc }}', 'base64').toString('ascii'));
29-
for(const k in etc){
30-
core.exportVariable(`WORKFLOW_ETC_${String(k).toUpperCase()}`, `${etc[k]}`);
43+
core.exportVariable('WORKFLOW_BUILD_BASE64JSON', Buffer.from(JSON.stringify({build:etc?.build})).toString('base64'));
44+
if(etc?.unraid){
45+
core.exportVariable(`WORKFLOW_BUILD_UNRAID`, `${etc.unraid}`);
46+
core.exportVariable('WORKFLOW_BUILD_UNRAID_BASE64JSON', Buffer.from(JSON.stringify({semversuffix:"unraid", uid:99, gid:100, build:etc?.build})).toString('base64'));
47+
}
48+
if(etc?.nobody){
49+
core.exportVariable(`WORKFLOW_BUILD_NOBODY`, `${etc.nobody}`);
50+
core.exportVariable('WORKFLOW_BUILD_NOBODY_BASE64JSON', Buffer.from(JSON.stringify({semversuffix:"nobody", uid:65534, gid:65534, build:etc?.build})).toString('base64'));
3151
}
3252
}catch(e){
33-
core.setFailed(`could not parse etc: ${e}`);
53+
core.setFailed(`could not parse: ${e}`);
3454
}
3555
})();
3656
@@ -41,24 +61,24 @@ jobs:
4161
workflow: docker.yml
4262
wait-for-completion: false
4363
token: "${{ secrets.REPOSITORY_TOKEN }}"
44-
inputs: '{ "release":"true", "readme":"true", "run-name":"build ${{ github.event.inputs.ref }}" }'
64+
inputs: '{ "release":"${{ github.event.inputs.release }}", "readme":"${{ github.event.inputs.readme }}", "run-name":"build ${{ github.event.inputs.ref }}", "etc":"${{ env.WORKFLOW_BUILD_BASE64JSON }}" }'
4565

4666
# UNRAID
4767
- name: build container image for unraid
48-
if: env.WORKFLOW_ETC_UNRAID == 'true'
68+
if: env.WORKFLOW_BUILD_UNRAID == 'true'
4969
uses: the-actions-org/workflow-dispatch@3133c5d135c7dbe4be4f9793872b6ef331b53bc7
5070
with:
5171
workflow: docker.yml
5272
wait-for-completion: false
5373
token: "${{ secrets.REPOSITORY_TOKEN }}"
54-
inputs: '{ "release":"false", "readme":"false", "run-name":"build unraid ${{ github.event.inputs.ref }}", "etc":"eyJzZW12ZXJzdWZmaXgiOiJ1bnJhaWQiLCJ1aWQiOjk5LCJnaWQiOjEwMH0=" }'
74+
inputs: '{ "release":"false", "readme":"false", "run-name":"build unraid ${{ github.event.inputs.ref }}", "etc":"${{ env.WORKFLOW_BUILD_UNRAID_BASE64JSON }}" }'
5575

5676
# NOBODY
5777
- name: build container image for nobody
58-
if: env.WORKFLOW_ETC_NOBODY == 'true'
78+
if: env.WORKFLOW_BUILD_NOBODY == 'true'
5979
uses: the-actions-org/workflow-dispatch@3133c5d135c7dbe4be4f9793872b6ef331b53bc7
6080
with:
6181
workflow: docker.yml
6282
wait-for-completion: false
6383
token: "${{ secrets.REPOSITORY_TOKEN }}"
64-
inputs: '{ "release":"false", "readme":"false", "run-name":"build nobody ${{ github.event.inputs.ref }}", "etc":"eyJzZW12ZXJzdWZmaXgiOiJub2JvZHkiLCJ1aWQiOjY1NTM0LCJnaWQiOjY1NTM0fQ==" }'
84+
inputs: '{ "release":"false", "readme":"false", "run-name":"build nobody ${{ github.event.inputs.ref }}", "etc":"${{ env.WORKFLOW_BUILD_NOBODY_BASE64JSON }}" }'

.github/workflows/org.readme.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: org.readme
22

3+
env:
4+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
5+
36
on:
47
workflow_dispatch:
58

.github/workflows/org.update.yml

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
name: org.update
22

3+
env:
4+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
5+
36
on:
47
workflow_dispatch:
58
inputs:
69
etc:
710
description: 'base64 encoded json string'
811
required: true
912

13+
release:
14+
description: 'create a release'
15+
required: false
16+
default: 'true'
17+
18+
readme:
19+
description: 'create a readme'
20+
required: false
21+
default: 'true'
22+
1023
jobs:
1124
update:
1225
runs-on: ubuntu-latest
@@ -17,27 +30,34 @@ jobs:
1730

1831
steps:
1932
- name: init / checkout
20-
uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2
33+
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v6.0.2
2134
with:
2235
ref: 'master'
2336
fetch-depth: 0
2437

2538
- name: update / setup node
26-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
39+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
2740
with:
28-
node-version: '20'
41+
node-version: '24'
2942
- run: npm i semver
3043

3144
- name: update / compare latest with current version
32-
uses: actions/github-script@62c3794a3eb6788d9a2a72b219504732c0c9a298
45+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
3346
with:
3447
script: |
3548
(async()=>{
3649
const { Buffer } = require('node:buffer');
3750
const { inspect } = require('node:util');
3851
const { existsSync, readFileSync, writeFileSync } = require('node:fs');
3952
const { resolve } = require('node:path');
40-
const semver = require('semver')
53+
const semver = require('semver');
54+
55+
const semverExceptions = (s) => {
56+
switch('${{ github.event.repository.name }}'){
57+
case 'docker-chrony': core.warning(`semver exception found for chrony version ${s}, setting version to major.minor`); return(s.split('.').slice(0, 2).join('.'));
58+
}
59+
return(s);
60+
}
4161
4262
// defaults
4363
const json = `${{ toJSON(github.event.inputs) }}`;
@@ -54,6 +74,8 @@ jobs:
5474
core.setFailed(`input does not contain valid semver version: ${inspect(job.inputs, {showHidden:false, depth:null, colors:true})}`);
5575
}else if(!job.inputs?.tag){
5676
core.setFailed(`input does not contain valid git tag: ${inspect(job.inputs, {showHidden:false, depth:null, colors:true})}`);
77+
}else if(job.inputs.version == 'null' || null === job.inputs.version){
78+
core.setFailed(`input version is null: ${inspect(job.inputs, {showHidden:false, depth:null, colors:true})}`);
5779
}
5880
}catch(e){
5981
core.setFailed(`could not parse github.event.inputs.etc: ${n.etc} (${Buffer.from(n.etc, 'base64').toString('ascii')})`);
@@ -81,28 +103,35 @@ jobs:
81103
}
82104
83105
// semver
84-
const latest = semver.valid(semver.coerce(job.inputs.version));
85-
const current = semver.valid(semver.coerce(job.json.semver.version));
106+
const latest = semverExceptions(semver.valid(semver.coerce(job.inputs.version)));
107+
const current = semverExceptions(semver.valid(semver.coerce(job.json.semver.version)));
86108
const tag = semver.valid(semver.coerce(job.inputs.tag));
87-
const checks = {latestTagExists:true};
109+
const checks = {latestTagExists:false};
88110
89111
try{
90112
const tag = await fetch(`https://hub.docker.com/v2/repositories/${job.json.image}/tags/${latest}`);
91-
if(tag.status === 404){
92-
checks.latestTagExists = false;
113+
if(tag.status === 200){
114+
checks.latestTagExists = true;
93115
}
94116
}catch(e){
95117
core.warning(e);
96118
}
97119
98120
// compare
99-
if((latest && latest !== current) || !checks.latestTagExists){
121+
if(latest && latest !== current && !checks.latestTagExists){
100122
core.info(`new ${semver.diff(current, latest)} release found (${latest}), updating ...`)
101123
job.json.semver.version = latest;
102124
103-
// check if app has a build version
104-
if(job.inputs?.build){
125+
// check if app has additional parameters
126+
const build = {};
127+
if(job.inputs?.build && typeof(job.inputs.build) === 'string'){
128+
build.args = {
129+
version_build:job.inputs.build,
130+
};
105131
job.json.build.args.version_build = job.inputs.build;
132+
}else if(job.inputs?.build?.args){
133+
build.args = job.inputs.build.args;
134+
job.json.build.args.version_build = job.inputs.build.args;
106135
}
107136
108137
// update .json
@@ -111,13 +140,14 @@ jobs:
111140
112141
// export variables
113142
core.exportVariable('WORKFLOW_UPDATE', true);
143+
core.exportVariable('WORKFLOW_UPDATE_BASE64JSON', Buffer.from(JSON.stringify({build:build})).toString('base64'));
114144
if(job.inputs?.unraid){
115145
core.exportVariable('WORKFLOW_UPDATE_UNRAID', 'true');
116-
core.exportVariable('WORKFLOW_UPDATE_UNRAID_BASE64JSON', Buffer.from(JSON.stringify({semversuffix:"unraid", uid:99, gid:100})).toString('base64'));
146+
core.exportVariable('WORKFLOW_UPDATE_UNRAID_BASE64JSON', Buffer.from(JSON.stringify({semversuffix:"unraid", uid:99, gid:100, build:build})).toString('base64'));
117147
}
118148
if(job.inputs?.nobody){
119149
core.exportVariable('WORKFLOW_UPDATE_NOBODY', 'true');
120-
core.exportVariable('WORKFLOW_UPDATE_NOBODY_BASE64JSON', Buffer.from(JSON.stringify({semversuffix:"nobody", uid:65534, gid:65534})).toString('base64'));
150+
core.exportVariable('WORKFLOW_UPDATE_NOBODY_BASE64JSON', Buffer.from(JSON.stringify({semversuffix:"nobody", uid:65534, gid:65534, build:build})).toString('base64'));
121151
}
122152
core.exportVariable('LATEST_TAG', semver.inc(tag, semver.diff(current, latest)));
123153
core.exportVariable('LATEST_VERSION', latest);
@@ -155,13 +185,13 @@ jobs:
155185
uses: the-actions-org/workflow-dispatch@3133c5d135c7dbe4be4f9793872b6ef331b53bc7
156186
with:
157187
workflow: docker.yml
158-
wait-for-completion: false
188+
wait-for-completion: true
159189
token: "${{ secrets.REPOSITORY_TOKEN }}"
160-
inputs: '{ "release":"true", "readme":"true", "run-name":"update v${{ env.LATEST_VERSION }}" }'
190+
inputs: '{ "release":"${{ github.event.inputs.release }}", "readme":"${{ github.event.inputs.readme }}", "run-name":"update v${{ env.LATEST_VERSION }}", "etc":"${{ env.WORKFLOW_UPDATE_BASE64JSON }}" }'
161191
ref: "v${{ env.LATEST_TAG }}"
162192

163193
- name: update / build container image for unraid
164-
if: env.WORKFLOW_UPDATE_UNRAID == 'true' && steps.checkout.outcome == 'success' && steps.build.outcome == 'success'
194+
if: env.WORKFLOW_UPDATE_UNRAID == 'true' && steps.build.outputs.workflow-conclusion == 'success'
165195
uses: the-actions-org/workflow-dispatch@3133c5d135c7dbe4be4f9793872b6ef331b53bc7
166196
with:
167197
workflow: docker.yml
@@ -171,7 +201,7 @@ jobs:
171201
ref: "v${{ env.LATEST_TAG }}"
172202

173203
- name: update / build container image for nobody
174-
if: env.WORKFLOW_UPDATE_NOBODY == 'true' && steps.checkout.outcome == 'success' && steps.build.outcome == 'success'
204+
if: env.WORKFLOW_UPDATE_NOBODY == 'true' && steps.build.outputs.workflow-conclusion == 'success'
175205
uses: the-actions-org/workflow-dispatch@3133c5d135c7dbe4be4f9793872b6ef331b53bc7
176206
with:
177207
workflow: docker.yml

.github/workflows/org.version.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: org.version
22
run-name: org.version ${{ inputs.version }}
33

4+
env:
5+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
6+
47
on:
58
workflow_dispatch:
69
inputs:
@@ -17,7 +20,7 @@ jobs:
1720
runs-on: ubuntu-latest
1821
steps:
1922
- name: setup config
20-
uses: actions/github-script@62c3794a3eb6788d9a2a72b219504732c0c9a298
23+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
2124
with:
2225
script: |
2326
const { Buffer } = require('node:buffer');

0 commit comments

Comments
 (0)