+36
-5
.github/workflows/darkroom.yml
+36
-5
.github/workflows/darkroom.yml
···
4
4
pull_request:
5
5
branches: [ main ]
6
6
paths: [ 'services/darkroom/**' ]
7
+
push:
8
+
branches: [ main ]
9
+
paths: [ 'services/darkroom/**' ]
7
10
8
11
jobs:
9
12
build:
···
51
54
docker stop darkroom-test
52
55
docker rm darkroom-test
53
56
57
+
- name: Save Docker image as artifact
58
+
if: github.ref == 'refs/heads/main'
59
+
run: docker save darkroom:latest | gzip > darkroom-image.tar.gz
60
+
61
+
- name: Upload Docker image artifact
62
+
if: github.ref == 'refs/heads/main'
63
+
uses: actions/upload-artifact@v4
64
+
with:
65
+
name: darkroom-docker-image
66
+
path: services/darkroom/darkroom-image.tar.gz
67
+
retention-days: 1
68
+
69
+
deploy:
70
+
if: github.ref == 'refs/heads/main'
71
+
needs: build
72
+
runs-on: ubuntu-latest
73
+
defaults:
74
+
run:
75
+
working-directory: services/darkroom
76
+
77
+
steps:
78
+
- name: Checkout code
79
+
uses: actions/checkout@v4
80
+
81
+
- name: Download Docker image artifact
82
+
uses: actions/download-artifact@v4
83
+
with:
84
+
name: darkroom-docker-image
85
+
path: services/darkroom/
86
+
87
+
- name: Load Docker image
88
+
run: docker load < darkroom-image.tar.gz
89
+
54
90
- name: Tag for Fly.io
55
-
if: github.ref == 'refs/heads/main'
56
91
run: docker tag darkroom:latest registry.fly.io/grain-darkroom:latest
57
92
58
93
- name: Setup Fly CLI
59
-
if: github.ref == 'refs/heads/main'
60
94
uses: superfly/flyctl-actions/setup-flyctl@master
61
95
62
96
- name: Login to Fly.io registry
63
-
if: github.ref == 'refs/heads/main'
64
97
run: flyctl auth docker
65
98
env:
66
99
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
67
100
68
101
- name: Push to Fly.io registry
69
-
if: github.ref == 'refs/heads/main'
70
102
run: docker push registry.fly.io/grain-darkroom:latest
71
103
72
104
- name: Deploy to Fly.io
73
-
if: github.ref == 'refs/heads/main'
74
105
run: flyctl deploy --image registry.fly.io/grain-darkroom:latest
75
106
env:
76
107
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}