Commit ff0de18 1 parent 0a3ebc9 commit ff0de18 Copy full SHA for ff0de18
File tree 2 files changed +30
-2
lines changed
2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 22
22
branches : ["master"]
23
23
pull_request :
24
24
branches : ["master"]
25
+ schedule :
26
+ - cron : " 0 3 * * *"
27
+
28
+ env :
29
+ IMAGE_NAME : delpa-redirection-server
25
30
26
31
jobs :
27
- test :
32
+ build :
28
33
name : Production Container Image
29
34
runs-on : ubuntu-24.04
35
+ permissions :
36
+ packages : write
37
+ contents : read
30
38
31
39
steps :
32
40
@@ -44,10 +52,29 @@ jobs:
44
52
run : npm run build_prod
45
53
46
54
- name : Start the container
47
- run : podman run --detach -p 3000:80 -p 3001:443 delpa-redirection-server
55
+ run : podman run --detach -p 3000:80 -p 3001:443 $IMAGE_NAME
48
56
49
57
- name : Install npm dependencies
50
58
run : npm ci
51
59
52
60
- name : Run test
53
61
run : npm run test_prod
62
+
63
+ # Push Only run below on master
64
+ - name : Log in to registry
65
+ if : github.ref == 'refs/heads/master'
66
+ run : echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
67
+
68
+ - name : Push image
69
+ if : github.ref == 'refs/heads/master'
70
+ run : |
71
+ IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
72
+
73
+ # This changes all uppercase characters to lowercase.
74
+ IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
75
+ VERSION=latest
76
+
77
+ echo IMAGE_ID=$IMAGE_ID
78
+ echo VERSION=$VERSION
79
+ podman tag $IMAGE_NAME $IMAGE_ID:$VERSION
80
+ podman push $IMAGE_ID:$VERSION
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ FROM docker.io/caddy:2.8.4-alpine@sha256:e97e0e3f8f51be708a9d5fadbbd75e3398c22fc
51
51
52
52
LABEL org.opencontainers.image.authors=
"Hong Xu <[email protected] >"
53
53
LABEL org.opencontainers.image.title="Delpa Redirection Server"
54
+ LABEL org.opencontainers.image.source=https://github.com/delpa-org/redirection-server
54
55
LABEL org.opencontainers.image.licenses=AGPL-3.0-or-later
55
56
56
57
COPY --from=caddyfile-builder Caddyfile /etc/caddy/
You can’t perform that action at this time.
0 commit comments