-
Notifications
You must be signed in to change notification settings - Fork 18
113 lines (105 loc) 路 3.62 KB
/
deploy.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
name: 'Deploy to Production'
on:
release:
types: [created]
jobs:
release:
name: 'Build and Release'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # to enable use of OIDC for npm provenance
packages: write
steps:
- uses: actions/checkout@v4
- name: Set NPM Env
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Lerna publish
run: npx lerna publish from-git --yes --no-verify-access
env:
NPM_CONFIG_PROVENANCE: true
# Add a sleep to give npmjs.com the time to get the versions consistent
- run: sleep 15s
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
strykermutator/dashboard
ghcr.io/stryker-mutator/dashboard
- name: Build and push Docker image
uses: docker/build-push-action@v5
id: build
with:
context: ./docker
push: true
build-args: 'version=${{ steps.meta.outputs.version }}'
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
platforms: linux/amd64,linux/arm64/v8
cache-from: type=gha
cache-to: type=gha,mode=max
deploy-dashboard:
name: 'Deploy Dashboard'
runs-on: ubuntu-latest
needs: release
environment: Production
concurrency: Production Dashboard
steps:
- uses: actions/checkout@v4
- name: 'Login via Azure CLI'
uses: Azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS_DASHBOARD_PRODUCTION }}
- name: 'Deploy dashboard.stryker-mutator.io'
uses: azure/webapps-deploy@v3
with:
app-name: 'stryker-badge'
images: 'ghcr.io/stryker-mutator/dashboard:latest'
- name: 'Verify deployment'
run: node tasks/check-version dashboard https://dashboard.stryker-mutator.io/api/version ${GITHUB_REF:11}
deploy-badge-api:
name: 'Deploy badge-api.stryker-mutator.io'
runs-on: ubuntu-latest
needs: release
environment: Production
concurrency: Production Badge Api
steps:
- name: 'Checkout Github Action'
uses: actions/checkout@v4
- name: 'Login via Azure CLI'
uses: Azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS_PRODUCTION }}
- name: 'Download & prepare badge-api package'
run: ./tasks/download-badge-api-package.sh ${GITHUB_REF:11}
- name: 'Deploy badge-api.stryker-mutator.io'
uses: Azure/functions-action@v1.5.1
id: fa
with:
app-name: stryker-mutator-badge-api
package: 'package'
- name: 'Verify deployment'
run: node tasks/check-version badge-api https://badge-api.stryker-mutator.io/api/ ${GITHUB_REF:11}