-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (66 loc) · 2.13 KB
/
build-and-test.yaml
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
name: Build docker image
on:
push:
branches:
- main
tags:
- v*.*.*
pull_request: {}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- run: npm run test:unit:ci
- run: npm run build
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
harbor.computational.bio.uni-giessen.de/bakrep/ui
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: log
run: echo "TAGS ${{ steps.meta.outputs.tags }}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to docker registry
uses: docker/login-action@v2
with:
registry: harbor.computational.bio.uni-giessen.de
username: ${{ secrets.HARBOR_USER }}
password: ${{ secrets.HARBOR_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- uses: benjlevesque/[email protected]
id: short-sha
with:
length: 7
- name: Deploy
if: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
uses: actions-hub/kubectl@master
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
SHA: ${{ steps.short-sha.outputs.sha }}
with:
args: set image deployment/bakrep-ui bakrep-ui=harbor.computational.bio.uni-giessen.de/bakrep/ui:sha-${{ env.SHA }}