This repository has been archived by the owner on Nov 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
122 lines (112 loc) · 4.21 KB
/
github-actions.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
name: Tributech Catalog CI
on:
# Trigger the workflows on push or pull request,
# but only for the release and develop branches
# do not trigger for master (use git tag instead, see
# https://tributech.atlassian.net/wiki/spaces/TM/pages/99614725/Branches+Build-Pipelines+Tags#Issue-with-merge%2Fbuild-for-master-branch)
push:
branches: [release, develop, hotfix/*]
tags:
- '*'
pull_request:
branches: [release, develop, feature/*, hotfix/*]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: npm i --ci
- run: npm run generate-connectors
- run: npm run format:check
- run: npm run lint
- run: npm run test
- run: npm run build
image-api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=tributech.azurecr.io/catalog-api
TAGS=""
VERSION=alpha
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
TAGS="$TAGS,${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:beta,${DOCKER_IMAGE}:stable,${DOCKER_IMAGE}:latest"
elif [[ $GITHUB_REF == refs/heads/develop ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:beta"
elif [[ $GITHUB_REF == refs/heads/release/* ]]; then
VERSION=${GITHUB_REF#refs/release/}
TAGS="$TAGS,${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:beta"
fi
TAGS="$TAGS,${DOCKER_IMAGE}:${GITHUB_SHA::8},${DOCKER_IMAGE}:alpha"
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- run: npm i --ci
- name: Login to Azure Container Registry
uses: docker/login-action@v1
with:
registry: tributech.azurecr.io
username: ${{ secrets.AZURE_CLIENT_ID }}
password: ${{ secrets.AZURE_CLIENT_SECRET }}
- name: 'nx build'
run: npm run docker-api
env:
INPUT_TAGS: ${{ steps.prep.outputs.tags }}
INPUT_PUSH: ${{ github.event_name != 'pull_request' }}
image-ui:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=tributech.azurecr.io/catalog-ui
TAGS=""
VERSION=alpha
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
TAGS="$TAGS,${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:beta,${DOCKER_IMAGE}:stable,${DOCKER_IMAGE}:latest"
elif [[ $GITHUB_REF == refs/heads/develop ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:beta"
elif [[ $GITHUB_REF == refs/heads/release/* ]]; then
VERSION=${GITHUB_REF#refs/release/}
TAGS="$TAGS,${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:beta"
fi
TAGS="$TAGS,${DOCKER_IMAGE}:${GITHUB_SHA::8},${DOCKER_IMAGE}:alpha"
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- run: npm i --ci
- name: Login to Azure Container Registry
uses: docker/login-action@v1
with:
registry: tributech.azurecr.io
username: ${{ secrets.AZURE_CLIENT_ID }}
password: ${{ secrets.AZURE_CLIENT_SECRET }}
- name: 'nx build'
run: npm run docker-ui
env:
INPUT_TAGS: ${{ steps.prep.outputs.tags }}
INPUT_PUSH: ${{ github.event_name != 'pull_request' }}
npm:
runs-on: ubuntu-latest
if: contains(github.ref, '/heads/tags') || contains(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: npm i --ci
- run: npm run generate-connectors
# Set NPM token to be able to publish
- run: echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > ~/.npmrc
- run: npm whoami
- run: npm run affected:deploy-all