forked from home-operations/containers
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (91 loc) · 2.7 KB
/
release.yaml
File metadata and controls
97 lines (91 loc) · 2.7 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
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Release
on:
push:
branches:
- main
paths:
- apps/**
workflow_dispatch:
inputs:
app:
type: string
description: App Name
required: true
release:
type: boolean
description: Release
required: false
default: false
jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
changed-files: ${{ steps.changed-files.outputs.changed_files }}
steps:
- name: Get Changed Files
uses: bjw-s-labs/action-changed-files@015416e33c709af88f84a4496f4030c1f0ef212e # v0.5.0
id: changed-files
with:
path: apps
include_only_directories: true
max_depth: 1
changed:
if: ${{ needs.prepare.outputs.changed-files != '[]' || github.event_name == 'workflow_dispatch' }}
name: Get Changed Apps
needs:
- prepare
runs-on: ubuntu-latest
outputs:
apps: ${{ steps.apps.outputs.apps }}
steps:
- name: Get Apps
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
id: apps
env:
APPS: ${{ github.event_name == 'workflow_dispatch' && inputs.app || join(fromJSON(needs.prepare.outputs.changed-files), ' ') }}
with:
script: |-
const { APPS } = process.env;
const appsToBuild = APPS.split(' ').filter(Boolean);
core.setOutput('apps', JSON.stringify(appsToBuild));
console.log('apps:', JSON.stringify(appsToBuild, null, 2));
core.summary.addHeading('Apps to build:').addList(appsToBuild).write();
build:
if: ${{ needs.changed.outputs.apps != '[]' }}
name: Build ${{ matrix.app }}
needs:
- changed
uses: ./.github/workflows/app-builder.yaml
permissions:
attestations: write
contents: write
id-token: write
packages: write
security-events: write
secrets: inherit
strategy:
matrix:
app: ${{ fromJSON(needs.changed.outputs.apps) }}
fail-fast: false
max-parallel: 4
with:
app: ${{ matrix.app }}
release: ${{ github.event_name == 'workflow_dispatch' && inputs.release || github.event_name == 'push' }}
status:
if: ${{ !cancelled() }}
name: Build Success
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Any jobs failed?
if: ${{ contains(needs.*.result, 'failure') }}
run: |-
exit 1
- name: All jobs passed or skipped?
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: |-
echo "All jobs passed or skipped" && echo "${{ toJSON(needs.*.result) }}"