-
Notifications
You must be signed in to change notification settings - Fork 8
128 lines (128 loc) · 4.6 KB
/
develop.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
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
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+-dev.[0-9]+'
jobs:
install-dependencies:
name: Install Dependencies
runs-on: ubuntu-latest
environment: develop
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
cache-dependency-path: yarn.lock
- name: Restore Dependencies Cache
uses: actions/cache/restore@v4
id: cache-restore
with:
path: |
node_modules
.husky
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
run: yarn --frozen-lockfile --no-progress --non-interactive
if: steps.cache-restore.outputs.cache-hit != 'true'
- name: Save Dependencies Cache
uses: actions/cache/save@v4
if: steps.cache-restore.outputs.cache-hit != 'true'
id: cache-save
with:
path: |
node_modules
.husky
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
test:
name: Run Test
runs-on: ubuntu-latest
needs: [install-dependencies]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
cache-dependency-path: yarn.lock
- name: Restore Dependencies Cache
uses: actions/cache/restore@v4
id: cache-restore-yarn
with:
path: |
node_modules
.husky
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Restore Tests Cache
uses: actions/cache/restore@v4
id: cache-restore-jest
with:
path: .jestcache
key: ${{ runner.os }}-jest-${{ hashFiles('**/yarn.lock') }}
- name: Running tests
env:
TZ: 'America/Sao_Paulo'
run: yarn test --cacheDirectory ".jestcache"
- name: Save Tests Cache
uses: actions/cache/save@v4
id: cache-save
with:
path: .jestcache
key: ${{ steps.cache-restore-jest.outputs.cache-primary-key }}
build:
name: Build image
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ steps.latestrelease.outputs.releasetag }}
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
cache-dependency-path: yarn.lock
- name: Restore Dependencies Cache
uses: actions/cache/restore@v4
id: cache-restore
with:
path: |
node_modules
.husky
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Build
run: yarn build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Get the tag name
run: |
echo "Tag name from GITHUB_REF_NAME: $GITHUB_REF_NAME"
echo "Tag name from github.ref_name: ${{ github.ref_name }}"
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
push: true
tags: konecty/konecty:${{ github.ref_name }}
build-args: |
VERSION=${{ github.ref_name }}