Skip to content

Commit 066daeb

Browse files
committed
Reworked GHA workflow to allow multiple environments
1 parent 4273f98 commit 066daeb

File tree

1 file changed

+51
-21
lines changed

1 file changed

+51
-21
lines changed

.github/workflows/build.yml

Lines changed: 51 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,62 @@ jobs:
2121
- name: Run Biome
2222
run: biome ci .
2323

24-
build-test-deploy:
25-
name: Build, Test and Deploy
24+
test:
25+
name: Test
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Run Tests
32+
run: yarn test
33+
34+
- name: Export ActivityPub image to .tar
35+
run: docker save activitypub -o activitypub.tar
36+
37+
- name: Export Migrations image to .tar
38+
run: docker save migrations -o migrations.tar
39+
40+
- name: Upload ActivityPub image to GHA
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: activitypub.tar
44+
path: activitypub.tar
45+
46+
- name: Upload Migrations image to GHA
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: migrations.tar
50+
path: migrations.tar
51+
52+
deploy:
53+
name: Deploy
54+
needs: [lint, test]
55+
if: github.ref == 'refs/heads/main'
2656
environment: build
2757
runs-on: ubuntu-latest
2858
steps:
29-
- name: "Checkout"
59+
- name: Checkout
3060
uses: actions/checkout@v4
3161

62+
- name: Download ActivityPub image from GHA
63+
uses: actions/download-artifact@v4
64+
with:
65+
name: activitypub.tar
66+
path: activitypub.tar
67+
68+
- name: Download Migrations image from GHA
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: migrations.tar
72+
path: migrations.tar
73+
74+
- name: Load ActivityPub image
75+
run: docker load -i activitypub.tar
76+
77+
- name: Load Migrations image
78+
run: docker load -i migrations.tar
79+
3280
- name: ActivityPub Docker meta
3381
id: activitypub-docker-metadata
3482
uses: docker/metadata-action@v5
@@ -55,23 +103,6 @@ jobs:
55103
type=semver,pattern={{major}}
56104
type=sha,priority=1100
57105
58-
- name: "Build Docker Image for ActivityPub"
59-
uses: docker/build-push-action@v6
60-
with:
61-
context: .
62-
load: true
63-
tags: ${{ steps.activitypub-docker-metadata.outputs.tags }}
64-
65-
- name: "Build Docker Image for Migrations"
66-
uses: docker/build-push-action@v6
67-
with:
68-
context: migrate
69-
load: true
70-
tags: ${{ steps.migrations-docker-metadata.outputs.tags }}
71-
72-
- name: "Run Tests"
73-
run: yarn test
74-
75106
- name: "Login to GAR"
76107
if: github.ref == 'refs/heads/main'
77108
uses: docker/login-action@v3
@@ -81,7 +112,6 @@ jobs:
81112
password: ${{ secrets.SERVICE_ACCOUNT_KEY }}
82113

83114
- name: "Push ActivityPub Docker Image"
84-
if: github.ref == 'refs/heads/main'
85115
uses: docker/build-push-action@v6
86116
with:
87117
context: .

0 commit comments

Comments
 (0)