-
Notifications
You must be signed in to change notification settings - Fork 4
100 lines (87 loc) · 2.8 KB
/
production.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
name: Build production image
on:
#workflow_run:
# workflows: ["Test and build staging-image"]
# branches: [master]
# types: [completed]
release:
types: [published]
jobs:
build:
name: 'Build and publish production image'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: lomake
tags: production ${{ github.sha }}
containerfiles: |
./Dockerfile
build-args: |
BASE_PATH=/tilannekuva/
SENTRY_ENVIRONMENT=production
extra-args: |
--ulimit nofile=4096:4096
- name: Push to quay.io
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: quay.io/toska
username: toska+github
password: ${{ secrets.QUAY_IO_TOKEN }}
report_success:
name: 'Report release success to Tilku-channel'
runs-on: ubuntu-latest
needs:
- build
if: success()
steps:
- name: 'Send notification to Slack'
uses: UniversityOfHelsinkiCS/[email protected]
with:
webhook-url: ${{ secrets.WEBHOOK_URL }}
message-type: deployment
softa-url: https://opetushallinto.cs.helsinki.fi/tilannekuva
deployment-target: production
report_failure:
name: 'Report release failure to Tilku-channel'
runs-on: ubuntu-latest
needs:
- build
if: failure()
steps:
- name: 'Send notification to Slack'
uses: UniversityOfHelsinkiCS/[email protected]
with:
webhook-url: ${{ secrets.WEBHOOK_URL }}
message-type: deployment-failure
sentry-release:
name: 'Create Sentry release'
runs-on: ubuntu-latest
needs: report_success
steps:
- uses: actions/checkout@v4
- name: Extract release version
id: extract_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Pull image and create a container
run: docker create --name lomake_sentry quay.io/toska/lomake:production
- name: Copy assets from the container
run: docker cp lomake_sentry:/opt/app-root/src/build ./build
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_URL: https://toska.cs.helsinki.fi/
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_TOKEN }}
SENTRY_ORG: toska
SENTRY_PROJECT: lomake
with:
environment: production
set_commits: 'skip'
sourcemaps: './build'
url_prefix: '~/tilannekuva'
version: ${{ steps.extract_version.outputs.VERSION }}