-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (145 loc) · 5.75 KB
/
ci.yml
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
on:
workflow_call:
inputs:
forge_version:
description: |
The version of the forge CLI to install (use 'local' for testing)
type: string
required: false
default: latest
secrets:
earthly_token:
description: Optional Earthly token used to login to Earthly cloud during local builds of Forge CLI
required: false
env:
FORGE_REGEX_CHECK: ^check(-.*)?$
FORGE_REGEX_BUILD: ^build(-.*)?$
FORGE_REGEX_PACKAGE: ^package(-.*)?$
FORGE_REGEX_TEST: ^test(-.*)?$
FORGE_REGEX_DOCS: ^docs(-.*)?$
FORGE_REGEX_RELEASE: ^release(-.*)?$
FORGE_REGEX_PUBLISH: ^publish(-.*)?$
jobs:
discover:
runs-on: ubuntu-latest
outputs:
deployments: ${{ steps.discovery.outputs.deployments }}
earthfiles: ${{ steps.discovery.outputs.earthfiles }}
steps:
- uses: actions/checkout@v4
- name: Install Forge
uses: input-output-hk/catalyst-forge/actions/install@ci/v1.1.1
if: ${{ inputs.forge_version != 'local' }}
with:
version: ${{ inputs.forge_version }}
- name: Install Local Forge
uses: input-output-hk/catalyst-forge/actions/install-local@ci/v1.1.1
if: ${{ inputs.forge_version == 'local' }}
with:
earthly_token: ${{ secrets.earthly_token }}
- name: Check forge version
id: local
run: |
forge version
if [[ "${{ inputs.forge_version }}" == "local" ]]; then
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: Setup CI
uses: input-output-hk/catalyst-forge/actions/setup@ci/v1.1.1
with:
skip_docker: 'true'
skip_github: 'true'
skip_earthly: ${{ steps.local.outputs.skip }}
- name: Discovery
id: discovery
uses: input-output-hk/catalyst-forge/actions/discovery@ci/v1.1.1
with:
filters: |
${{ env.FORGE_REGEX_CHECK }}
${{ env.FORGE_REGEX_BUILD }}
${{ env.FORGE_REGEX_PACKAGE }}
${{ env.FORGE_REGEX_TEST }}
${{ env.FORGE_REGEX_DOCS }}
${{ env.FORGE_REGEX_RELEASE }}
${{ env.FORGE_REGEX_PUBLISH }}
check:
uses: ./.github/workflows/run.yml@ci/v1.1.1
needs: [discover]
if: (fromJson(needs.discover.outputs.earthfiles)['^check(-.*)?$'] != null) && !failure() && !cancelled()
with:
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.earthfiles)['^check(-.*)?$']) }}
forge_version: ${{ inputs.forge_version }}
secrets:
earthly_token: ${{ secrets.earthly_token }}
build:
uses: ./.github/workflows/run.yml@ci/v1.1.1
needs: [discover, check]
if: (fromJson(needs.discover.outputs.earthfiles)['^build(-.*)?$'] != null) && !failure() && !cancelled()
with:
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.earthfiles)['^build(-.*)?$']) }}
forge_version: ${{ inputs.forge_version }}
secrets:
earthly_token: ${{ secrets.earthly_token }}
package:
uses: ./.github/workflows/run.yml@ci/v1.1.1
needs: [discover, check, build]
if: (fromJson(needs.discover.outputs.earthfiles)['^package(-.*)?$'] != null) && !failure() && !cancelled()
with:
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.earthfiles)['^package(-.*)?$']) }}
forge_version: ${{ inputs.forge_version }}
secrets:
earthly_token: ${{ secrets.earthly_token }}
test:
uses: ./.github/workflows/run.yml@ci/v1.1.1
needs: [discover, check, build, package]
if: (fromJson(needs.discover.outputs.earthfiles)['^test(-.*)?$'] != null) && !failure() && !cancelled()
with:
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.earthfiles)['^test(-.*)?$']) }}
forge_version: ${{ inputs.forge_version }}
secrets:
earthly_token: ${{ secrets.earthly_token }}
docs:
uses: ./.github/workflows/docs.yml@ci/v1.1.1
needs: [discover, check, build, test]
if: (fromJson(needs.discover.outputs.earthfiles)['^docs(-.*)?$'] != null) && !failure() && !cancelled()
with:
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.earthfiles)['^docs(-.*)?$']) }}
forge_version: ${{ inputs.forge_version }}
secrets:
earthly_token: ${{ secrets.earthly_token }}
publish:
uses: ./.github/workflows/publish.yml@ci/v1.1.1
needs: [discover, check, build, test]
if: (fromJson(needs.discover.outputs.earthfiles)['^publish(-.*)?$'] != null) && !failure() && !cancelled()
with:
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.earthfiles)['^publish(-.*)?$']) }}
forge_version: ${{ inputs.forge_version }}
secrets:
earthly_token: ${{ secrets.earthly_token }}
deploy:
uses: ./.github/workflows/deploy.yml@ci/v1.1.1
needs: [discover, check, build, test, publish]
if: (fromJson(needs.discover.outputs.deployments)[0] != null) && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && !failure() && !cancelled()
with:
deployments: ${{ needs.discover.outputs.deployments }}
forge_version: ${{ inputs.forge_version }}
secrets:
earthly_token: ${{ secrets.earthly_token }}
release:
uses: ./.github/workflows/release.yml@ci/v1.1.1
needs: [discover, check, build, test]
if: (fromJson(needs.discover.outputs.earthfiles)['^release(-.*)?$'] != null) && !failure() && !cancelled()
with:
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.earthfiles)['^release(-.*)?$']) }}
forge_version: ${{ inputs.forge_version }}
secrets:
earthly_token: ${{ secrets.earthly_token }}
final:
needs: [check, build, package, test, publish, release]
if: (!failure() && !cancelled())
runs-on: ubuntu-latest
steps:
- name: Final
run: echo "All done"