-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (68 loc) · 1.86 KB
/
scheduled.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
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Scheduled Release
concurrency:
group: container-release
cancel-in-progress: false
on:
workflow_dispatch:
inputs:
apps:
description: App(s)
required: false
type: string
action:
description: Action
required: false
default: 'build'
type: choice
options:
- build
- clean
schedule:
- cron: "0 1 * * *"
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
apps: "${{ steps.prep-apps.outputs.apps }}"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Populate apps
id: prep-apps
shell: bash
run: |
IMAGES="$(find images -mindepth 1 -maxdepth 1 -type d -printf %f\\n | jq -R -s -c 'split("\n")[:-1]')"
INPUT='${{ inputs.apps }}'
echo "apps=${INPUT:-$IMAGES}" >> $GITHUB_OUTPUT
build-images:
if: ${{ inputs.action == null || inputs.action == 'build' }}
permissions:
contents: read
packages: write
uses: lehmanju/containers/.github/workflows/build-images.yaml@main
needs: ["prepare"]
secrets: inherit
with:
appsToBuild: "${{ needs.prepare.outputs.apps }}"
pushImages: true
cleanup:
runs-on: ubuntu-latest
if: ${{ inputs.action == null || inputs.action == 'clean' }}
needs: ["prepare"]
strategy:
fail-fast: false
matrix:
image: "${{ fromJSON(needs.prepare.outputs.apps) }}"
permissions:
contents: read
packages: write
steps:
- name: Cleanup old containers
uses: actions/delete-package-versions@v5
with:
package-name: '${{ matrix.image }}'
package-type: 'container'
min-versions-to-keep: 10
delete-only-untagged-versions: 'true'