-
Notifications
You must be signed in to change notification settings - Fork 53
174 lines (165 loc) · 6.71 KB
/
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
name: Release on push to main
on:
push:
branches:
- main
jobs:
release:
name: "Release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Calculate release version
run: |
echo "release_version=1.$(date +'%g%m%d%H%M').0-alpha" >> $GITHUB_ENV
- name: Set version
run: |
sed -i "s/1.SNAPSHOT/${{ env.release_version }}/g" build.gradle.kts
- run: |
git tag v${{ env.release_version }}
git push --tags
- name: Setup cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Gradle wrapper validation
uses: gradle/wrapper-validation-action@v1
- name: Running gradle build
uses: eskatos/[email protected]
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
with:
arguments: build publish --no-daemon
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get changed files in the waltid-issuer-api directory
id: issuer-changed-files
uses: tj-actions/changed-files@v40
with:
files: 'waltid-issuer-api/**'
- name: Build and push Docker images (issuer)
uses: docker/[email protected]
with:
push: true
file: waltid-issuer-api/Dockerfile
tags: waltid/issuer-api:latest, waltid/issuer-api:${{ env.release_version }}
if: ${{ steps.issuer-changed-files.outputs.any_changed == 'true' }}
- name: Get changed files in the waltid-verifier-api directory
id: verifier-changed-files
uses: tj-actions/changed-files@v40
with:
files: 'waltid-verifier-api/**'
- name: Build and push Docker images (verifier)
uses: docker/[email protected]
with:
push: true
file: waltid-verifier-api/Dockerfile
tags: waltid/verifier-api:latest, waltid/verifier-api:${{ env.release_version }}
if: ${{ steps.verifier-changed-files.outputs.any_changed == 'true' }}
- name: Get changed files in the waltid-web-wallet directory
id: wallet-changed-files
uses: tj-actions/changed-files@v40
with:
files: 'waltid-web-wallet/**'
- name: Build and push Docker images (wallet-backend)
uses: docker/[email protected]
with:
push: true
file: waltid-web-wallet/backend.Dockerfile
tags: waltid/wallet-backend:latest, waltid/wallet-backend:${{ env.release_version }}
if: ${{ steps.wallet-changed-files.outputs.any_changed == 'true' }}
- name: Build and push Docker images (wallet-frontend)
uses: docker/[email protected]
with:
push: true
file: waltid-web-wallet/frontend.Dockerfile
tags: waltid/wallet-frontend:latest, waltid/wallet-frontend:${{ env.release_version }}
if: ${{ steps.wallet-changed-files.outputs.any_changed == 'true' }}
- name: Get changed files in the waltid-web-portal directory
id: portal-changed-files
uses: tj-actions/changed-files@v40
with:
files: 'waltid-web-portal/**'
- name: Build and push Docker images (wallet-portal)
uses: docker/build-push-action@v4
with:
push: true
file: waltid-web-portal/Dockerfile
tags: waltid/portal:latest, waltid/portal:${{ env.release_version }}
if: ${{ steps.portal-changed-files.outputs.any_changed == 'true' }}
- name: Changelog
uses: ardalanamini/auto-changelog@v3
id: changelog
with:
github-token: ${{ github.token }}
commit-types: |
breaking: Breaking Changes
feat: New Features
fix: Bug Fixes
revert: Reverts
perf: Performance Improvements
refactor: Refactors
deps: Dependencies
docs: Documentation Changes
style: Code Style Changes
build: Build System
ci: Continuous Integration
test: Tests
chore: Chores
other: Other Changes
default-commit-type: Other Changes
release-name: v${{ env.release_version }}
mention-authors: true
mention-new-contributors: true
include-compare: true
semver: true
- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.release_version }}
body: |
${{ steps.changelog.outputs.changelog }}
prerelease: ${{ steps.changelog.outputs.prerelease }}
- name: Prepare CD - issuer
run: sed "s/_DEFAULT_DEPLOYMENT_/$GITHUB_SHA/g" waltid-issuer-api/k8s/deployment-prod.yaml > waltid-issuer-api/k8s/deployment_mod.yaml
# - name: Continuous deployment - issuer
# uses: actions-hub/kubectl@master
# env:
# KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
# with:
# args: apply -n portals -f waltid-issuer-api/k8s/deployment_mod.yaml
- name: Prepare CD - verifier
run: sed "s/_DEFAULT_DEPLOYMENT_/$GITHUB_SHA/g" waltid-verifier-api/k8s/deployment-prod.yaml > waltid-verifier-api/k8s/deployment_mod.yaml
# - name: Continuous deployment - verifier
# uses: actions-hub/kubectl@master
# env:
# KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
# with:
# args: apply -n portals -f waltid-verifier-api/k8s/deployment_mod.yaml
- name: Prepare CD - wallet.walt.id
run: sed "s/_DEFAULT_DEPLOYMENT_/$GITHUB_SHA/g" waltid-web-wallet/k8s/deployment-prod.yaml > waltid-web-wallet/k8s/deployment_mod.yaml
- name: Continuous deployment - wallet.walt.id
uses: actions-hub/kubectl@master
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
with:
args: apply -n default -f waltid-web-wallet/k8s/deployment_mod.yaml
- name: Prepare CD - portal.walt.id
run: sed "s/_DEFAULT_DEPLOYMENT_/$GITHUB_SHA/g" waltid-web-portal/k8s/deployment-prod.yaml > waltid-web-portal/k8s/deployment_mod.yaml
- name: Continuous deployment - portal.walt.id
uses: actions-hub/kubectl@master
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
with:
args: apply -n portals -f waltid-web-portal/k8s/deployment_mod.yaml