-
Notifications
You must be signed in to change notification settings - Fork 3
179 lines (147 loc) · 6.45 KB
/
prod-release.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: Publish graduated release
on:
workflow_dispatch:
pull_request:
types: [closed]
branches:
- master
jobs:
variables:
name: Set variables
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.vars.outputs.tag }}
image_manage: ${{ steps.vars.outputs.image_manage }}
image_presentation: ${{ steps.vars.outputs.image_presentation }}
image_semcom_node: ${{ steps.vars.outputs.image_semcom_node }}
image_semcom_components: ${{ steps.vars.outputs.image_semcom_components }}
image_pods: ${{ steps.vars.outputs.image_pods }}
image_id_proxy: ${{ steps.vars.outputs.image_id_proxy }}
image_webid: ${{ steps.vars.outputs.image_webid }}
steps:
- name: Set variables
id: vars
run: |
echo "::set-output name=tag::${GITHUB_REF/refs\/tags\//}"
echo "::set-output name=image_manage::ghcr.io/netwerk-digitaal-erfgoed/solid-crs-manage"
echo "::set-output name=image_presentation::ghcr.io/netwerk-digitaal-erfgoed/solid-crs-presentation"
echo "::set-output name=image_semcom_node::ghcr.io/netwerk-digitaal-erfgoed/solid-crs-semcom-node"
echo "::set-output name=image_semcom_components::ghcr.io/netwerk-digitaal-erfgoed/solid-crs-semcom-components"
publish-npm:
name: Publish NPM packages
runs-on: ubuntu-latest
needs: [variables]
outputs:
version: ${{steps.discover-version.outputs.prop}}
steps:
- name: Checkout ref
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fetch more tags
run: git fetch --tags
- name: Configure git
run: |
git config user.name ${{github.actor}}
git config user.email ${{github.actor}}@users.noreply.github.com
git remote set-url origin https://${{github.actor}}:${{secrets.ACTIONS_PUSH}}@github.com/${{github.repository}}.git
- uses: actions/setup-node@v1
with:
node-version: 14
registry-url: https://npm.pkg.github.com/
- run: npm run bootstrap
env:
NODE_AUTH_TOKEN: ${{ secrets.DIGITA_PACKAGES }}
- name: Build packages
run: npm run build:all
- name: Publish packages
id: publish-packages
run: npx lerna publish --no-verify-access --conventional-commits --conventional-graduate --yes --no-push
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Git reset
run: git reset HEAD --hard && git status
- name: Discover version
id: discover-version
uses: notiz-dev/github-action-json-property@release
with:
path: 'lerna.json'
prop_path: 'version'
- name: Push changes to master
run: |
git -c "http.https://github.com/.extraheader=" push && git push origin v${{steps.discover-version.outputs.prop}}
publish-docker:
name: Publish Docker images
needs: [variables, publish-npm]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CONTAINER_REGISTRY_TOKEN }}
- name: Build and push manage
uses: docker/build-push-action@v2
with:
context: packages/solid-crs-manage/
push: true
tags: |
${{ needs.variables.outputs.image_manage }}:latest
${{ needs.variables.outputs.image_manage }}:v${{needs.publish-npm.outputs.version}}
build-args: |
NPM_TOKEN=${{secrets.DIGITA_PACKAGES}}
- name: Build and push presentation
uses: docker/build-push-action@v2
with:
context: packages/solid-crs-presentation/
push: true
tags: |
${{ needs.variables.outputs.image_presentation }}:latest
${{ needs.variables.outputs.image_presentation }}:v${{needs.publish-npm.outputs.version}}
build-args: |
NPM_TOKEN=${{secrets.DIGITA_PACKAGES}}
- name: Build and push semcom-node
uses: docker/build-push-action@v2
with:
context: packages/solid-crs-semcom-node/
push: true
tags: |
${{ needs.variables.outputs.image_semcom_node }}:latest
${{ needs.variables.outputs.image_semcom_node }}:v${{needs.publish-npm.outputs.version}}
build-args: |
NPM_TOKEN=${{secrets.DIGITA_PACKAGES}}
- name: Build and push semcom-components
uses: docker/build-push-action@v2
with:
context: packages/solid-crs-semcom-components/
push: true
tags: |
${{ needs.variables.outputs.image_semcom_components }}:latest
${{ needs.variables.outputs.image_semcom_components }}:v${{needs.publish-npm.outputs.version}}
build-args: |
NPM_TOKEN=${{secrets.DIGITA_PACKAGES}}
- uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Store DigitalOcean credentials
run: doctl kubernetes cluster kubeconfig save nde
# See https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#updating-a-deployment
- name: Update deployment
run: |
kubectl set image deployment/solid-crs-manage app=${{ needs.variables.outputs.image_manage }}:v${{needs.publish-npm.outputs.version}} --record
kubectl set image deployment/solid-crs-presentation app=${{ needs.variables.outputs.image_presentation }}:v${{needs.publish-npm.outputs.version}} --record
kubectl set image deployment/solid-crs-semcom-node app=${{ needs.variables.outputs.image_semcom_node }}:v${{needs.publish-npm.outputs.version}} --record
kubectl set image deployment/solid-crs-semcom-components app=${{ needs.variables.outputs.image_semcom_components }}:v${{needs.publish-npm.outputs.version}} --record
- name: Verify deployment
run: |
kubectl rollout status deployment/solid-crs-manage
kubectl rollout status deployment/solid-crs-presentation
kubectl rollout status deployment/solid-crs-semcom-node
kubectl rollout status deployment/solid-crs-semcom-components