1+ name : openssl
2+ on :
3+ workflow_dispatch :
4+ inputs :
5+ force :
6+ description : ' force build, regardless if tag exists already'
7+ required : false
8+ default : ' false'
9+ schedule :
10+ - cron : " 0 5 * * *"
11+ push :
12+ tags :
13+ - ' openssl'
14+ jobs :
15+ openssl :
16+ runs-on : ubuntu-latest
17+ steps :
18+ - name : cron-update / get latest version
19+ run : |
20+ LATEST_VERSION=$(curl -s https://api.github.com/repos/openssl/openssl/releases/latest | jq -r '.tag_name' | sed 's/openssl-//')
21+ if [ "${LATEST_VERSION}" != "null" ]; then
22+ if curl -kILs --fail https://hub.docker.com/v2/repositories/11notes/distroless/tags/openssl-${LATEST_VERSION}; then
23+ if [ "${{ github.event.inputs.force }}" == "true" ]; then
24+ echo "WORKFLOW_AUTO_UPDATE=true" >> "${GITHUB_ENV}"
25+ echo "LATEST_VERSION=${LATEST_VERSION}" >> "${GITHUB_ENV}"
26+ else
27+ echo "tag ${LATEST_VERSION} exists already!"
28+ fi
29+ else
30+ echo "WORKFLOW_AUTO_UPDATE=true" >> "${GITHUB_ENV}"
31+ echo "LATEST_VERSION=${LATEST_VERSION}" >> "${GITHUB_ENV}"
32+ fi
33+ else
34+ echo "tag ${LATEST_VERSION} is null!"
35+ fi
36+
37+ - name : init / base64 nested json
38+ if : env.WORKFLOW_AUTO_UPDATE == 'true'
39+ uses : actions/github-script@62c3794a3eb6788d9a2a72b219504732c0c9a298
40+ with :
41+ script : |
42+ const { Buffer } = require('node:buffer');
43+ const etc = {
44+ dockerfile:"openssl.dockerfile",
45+ tag:"openssl",
46+ version:"${{ env.LATEST_VERSION }}",
47+ semver:{disable:{rolling: true}}
48+ };
49+ core.exportVariable('WORKFLOW_BASE64JSON', Buffer.from(JSON.stringify(etc)).toString('base64'));
50+
51+ - name : build docker image
52+ if : env.WORKFLOW_AUTO_UPDATE == 'true'
53+ uses : the-actions-org/workflow-dispatch@3133c5d135c7dbe4be4f9793872b6ef331b53bc7
54+ with :
55+ wait-for-completion : false
56+ workflow : docker.yml
57+ token : " ${{ secrets.REPOSITORY_TOKEN }}"
58+ inputs : ' { "release":"false", "readme":"false", "run-name":"openssl", "etc":"${{ env.WORKFLOW_BASE64JSON }}" }'
0 commit comments