-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (135 loc) · 4.37 KB
/
publish.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
150
151
152
153
154
155
156
157
158
159
160
161
# This workflow publishes the Docker image to the GitHub Container Registry and the Helm chart to the appropriate s3 bucket.
# It's triggered when a new tag is pushed to the repository, this can either be in main (as a release tag) or in a feature
# branch (as a prerelease tag).
name: Publish
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
# Note this alone is not enough to give the action write access
# In the registry settings https://github.com/users/danielemery/packages/container/quizlord-api/settings
# you must also add the action with write access under Manage actions access
permissions:
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
NODE_VERSION: 18.17.1
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install packages
run: npm ci
- name: Build
run: npm run build
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: |
dist
prisma
Dockerfile
.dockerignore
package*.json
- name: Upload helm chart
uses: actions/upload-artifact@v3
with:
name: helm-chart
path: helm
docker-publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: nowsprinting/check-version-format-action@v3
id: version
with:
prefix: 'v'
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-artifacts
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=${{ steps.version.outputs.is_stable == 'true' && 'true' || 'false' }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
IMAGE_VERSION=${{ steps.version.outputs.full }}
helm-publish:
needs:
- build
- docker-publish
runs-on: ubuntu-latest
steps:
- uses: nowsprinting/check-version-format-action@v3
id: version
with:
prefix: 'v'
- name: Download chart definition
uses: actions/download-artifact@v3
with:
name: helm-chart
path: helm
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.HELM_DEPLOY_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.HELM_DEPLOY_SECRET }}
aws-region: ${{ vars.HELM_DEPLOY_REGION }}
- name: Publish chart
uses: danielemery/helm-release-action@f19adb815088a067bb839b224decb0611072652d
with:
repo: s3://helm.demery.net/
chart: ./helm
version: ${{ steps.version.outputs.full }}
appVersion: ${{ steps.version.outputs.full }}
sentry-sourcemaps-publish:
needs:
- build
- docker-publish
runs-on: ubuntu-latest
steps:
- uses: nowsprinting/check-version-format-action@v3
id: version
with:
prefix: 'v'
- name: Checkout
uses: actions/checkout@v4
- name: Download build artifacts with sourcemaps
uses: actions/download-artifact@v3
with:
name: build-artifacts
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
with:
environment: ${{ steps.version.outputs.is_stable == 'true' && 'prod' || 'stg' }}
sourcemaps: ./dist
version: ${{ steps.version.outputs.full }}
url_prefix: '/app'