Skip to content

Commit b68db58

Browse files
authored
Merge pull request #32 from posit-dev/split-dev-prod-ci
Split product.yml into separate development and production workflows
2 parents 4c8c700 + 6833884 commit b68db58

File tree

2 files changed

+77
-46
lines changed

2 files changed

+77
-46
lines changed

.github/workflows/development.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Development
2+
on:
3+
schedule:
4+
# Hourly rebuild of dev images
5+
- cron: "45 4 * * *" # At 04:45 every day
6+
7+
pull_request:
8+
9+
push:
10+
branches:
11+
- main
12+
13+
concurrency:
14+
# Only cancel in-progress runs for pull_request events, this prevents cancelling workflows against main or tags
15+
# A pull_request will reuse the same group thus enabling cancelation, all others receive a unique run_id
16+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
ci:
21+
name: CI
22+
# This should be the only action checked as required in the repo settings.
23+
#
24+
# This is a meta-job, here to express the conditions we require
25+
# in order to consider a CI run to be successful.
26+
if: always()
27+
28+
runs-on: ubuntu-latest
29+
timeout-minutes: 10
30+
needs:
31+
- dev
32+
33+
steps:
34+
- uses: re-actors/alls-green@release/v1
35+
with:
36+
jobs: ${{ toJSON(needs) }}
37+
38+
dev:
39+
name: Dev Build
40+
# Dev Build
41+
#
42+
# Builds all development versions of each image in parallel.
43+
#
44+
# Run on merges to main, or on hourly scheduled re-builds.
45+
permissions:
46+
contents: read
47+
packages: write
48+
id-token: write # Required for AWS OIDC login
49+
50+
uses: "posit-dev/images-shared/.github/workflows/bakery-build.yml@main"
51+
secrets:
52+
AWS_ROLE: ${{ secrets.AWS_ROLE }}
53+
with:
54+
runs-on: ubuntu-latest-4x
55+
dev-versions: "only"
56+
matrix-versions: "exclude"
57+
aws-region: us-west-2
58+
# Push images only for merges into main and hourly schduled re-builds.
59+
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'schedule' }}
60+
61+
clean:
62+
name: Clean
63+
if: always() && github.ref == 'refs/heads/main'
64+
permissions:
65+
contents: read
66+
packages: write
67+
needs:
68+
- dev
69+
70+
uses: "posit-dev/images-shared/.github/workflows/clean.yml@main"
71+
with:
72+
remove-dangling-caches: true
73+
remove-caches-older-than: 14
74+
clean-temporary-images: false
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
name: Product Images
1+
name: Production
22
on:
33
schedule:
44
# Weekly rebuild of all images, to pick up any upstream changes.
55
- cron: "15 3 * * 0" # At 03:15 on Sunday
6-
# Hourly rebuild of dev images
7-
- cron: "45 4 * * *" # At 04:45 every day
86

97
pull_request:
108

@@ -31,22 +29,11 @@ jobs:
3129
timeout-minutes: 10
3230
needs:
3331
- build
34-
- dev
3532

3633
steps:
3734
- uses: re-actors/alls-green@release/v1
3835
with:
3936
jobs: ${{ toJSON(needs) }}
40-
allowed-skips: ${{
41-
(
42-
github.event_name == 'schedule' &&
43-
(
44-
github.event.schedule != '15 3 * * 0' && '["build"]'
45-
||
46-
github.event.schedule != '45 4 * * 0' && '["dev"]'
47-
)
48-
) || '[]'
49-
}}
5037

5138
build:
5239
name: Build
@@ -55,7 +42,6 @@ jobs:
5542
# Builds all versions of each image in parallel.
5643
#
5744
# Run on merges to main, or on weekly scheduled re-builds.
58-
if: contains(fromJSON('["push", "pull_request"]'), github.event_name) || github.event.schedule == '15 3 * * 0'
5945
permissions:
6046
contents: read
6147
packages: write
@@ -68,32 +54,7 @@ jobs:
6854
dev-versions: "exclude"
6955
matrix-versions: "exclude"
7056
# Push images only for merges into main and weekly schduled re-builds.
71-
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event.schedule == '15 3 * * 0' }}
72-
73-
dev:
74-
name: Dev Build
75-
# Dev Build
76-
#
77-
# Builds all development versions of each image in parallel.
78-
#
79-
# Run on merges to main, or on hourly scheduled re-builds.
80-
if: contains(fromJSON('["push", "pull_request"]'), github.event_name) || github.event.schedule == '45 4 * * *'
81-
82-
permissions:
83-
contents: read
84-
packages: write
85-
id-token: write # Required for AWS OIDC login
86-
87-
uses: "posit-dev/images-shared/.github/workflows/bakery-build.yml@main"
88-
secrets:
89-
AWS_ROLE: ${{ secrets.AWS_ROLE }}
90-
with:
91-
runs-on: ubuntu-latest-4x
92-
dev-versions: "only"
93-
matrix-versions: "exclude"
94-
aws-region: us-west-2
95-
# Push images only for merges into main and hourly schduled re-builds.
96-
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event.schedule == '45 4 * * *' }}
57+
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'schedule' }}
9758

9859
clean:
9960
name: Clean
@@ -103,13 +64,9 @@ jobs:
10364
packages: write
10465
needs:
10566
- build
106-
- dev
10767

10868
uses: "posit-dev/images-shared/.github/workflows/clean.yml@main"
10969
with:
11070
remove-dangling-caches: true
11171
remove-caches-older-than: 14
112-
# FIXME: re-enable temporary image cleanup after moving to native platform workflow
113-
# remove-dangling-temporary-images: false
114-
# remove-temporary-images-older-than: 3
115-
clean-temporary-images: false
72+
clean-temporary-images: false

0 commit comments

Comments
 (0)