forked from inovex/scrumlr.io
-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (136 loc) · 5.35 KB
/
package.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
name: Package
on:
workflow_call:
outputs:
frontend-image-tag:
description: The tag of the frontend image
value: ${{ jobs.package-frontend.outputs.frontend-image-tag }}
server-image-tag:
description: The tag of the server image
value: ${{ jobs.package-server.outputs.server-image-tag }}
jobs:
determine-platforms:
runs-on: ubuntu-latest
outputs:
platforms: ${{ steps.platforms.outputs.platforms }}
steps:
- name: Set platforms
id: platforms
run: |
if [ "${{ github.event_name }}" == "release" ]; then
echo "platforms=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT
else
echo "platforms=linux/amd64" >> $GITHUB_OUTPUT
fi
package-frontend:
needs: determine-platforms
outputs:
frontend-image-tag: ${{ steps.outputs.outputs.frontend-image-tag }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: scrumlr.io - Frontend image meta information
id: meta-frontend
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/inovex/scrumlr.io/scrumlr-frontend
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest
type=sha,prefix=sha-,format=short
labels: |
org.opencontainers.image.url=https://github.com/inovex/scrumlr.io/pkgs/container/scrumlr.io%2Fscrumlr-frontend
org.opencontainers.image.source=https://github.com/inovex/scrumlr.io
org.opencontainers.image.vendor=inovex
org.opencontainers.image.licenses=MIT
org.opencontainers.image.title=scrumlr.io Frontend
org.opencontainers.image.description=The web client for scrumlr.io
- name: Build and push frontend images
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
platforms: ${{ needs.determine-platforms.outputs.platforms }}
push: true
tags: ${{ steps.meta-frontend.outputs.tags }}
labels: ${{ steps.meta-frontend.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/inovex/scrumlr.io/scrumlr-frontend:cache
cache-to: type=registry,ref=ghcr.io/inovex/scrumlr.io/scrumlr-frontend:cache,mode=max
- name: Set outputs
id: outputs
run: |
echo $DOCKER_METADATA_OUTPUT_TAGS
echo _____________________________________________________
echo frontend-image-tag=$(echo "$(echo $DOCKER_METADATA_OUTPUT_TAGS | grep -oP 'sha-[a-f0-9]+')" ) >> $GITHUB_OUTPUT
package-server:
needs: determine-platforms
outputs:
server-image-tag: ${{ steps.outputs.outputs.server-image-tag }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: scrumlr.io - Server image meta information
id: meta-server
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/inovex/scrumlr.io/scrumlr-server
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest
type=sha,prefix=sha-,format=short
labels: |
org.opencontainers.image.url=https://github.com/inovex/scrumlr.io/pkgs/container/scrumlr.io%2Fscrumlr-server
org.opencontainers.image.source=https://github.com/inovex/scrumlr.io
org.opencontainers.image.vendor=inovex
org.opencontainers.image.licenses=MIT
org.opencontainers.image.title=scrumlr.io Server
org.opencontainers.image.description=The server for scrumlr.io
- name: Build and push server images
uses: docker/build-push-action@v4
with:
context: ./server/src
file: ./server/src/Dockerfile
platforms: ${{ needs.determine-platforms.outputs.platforms }}
push: true
tags: ${{ steps.meta-server.outputs.tags }}
labels: ${{ steps.meta-server.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Set outputs
id: outputs
run: |
echo $DOCKER_METADATA_OUTPUT_TAGS
echo _____________________________________________________
echo server-image-tag=$(echo "$(echo $DOCKER_METADATA_OUTPUT_TAGS | grep -oP 'sha-[a-f0-9]+')" ) >> $GITHUB_OUTPUT