-
Notifications
You must be signed in to change notification settings - Fork 2
88 lines (79 loc) · 2.56 KB
/
build_tzsafe.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
name: Automatic build and push
on:
push:
branches:
- main
- release
pull_request:
branches:
- main
- release
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
docker:
name: "Docker build"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
if: ${{ github.event_name != 'pull_request' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release_branches: release
pre_release_branches: main
default_bump: minor
default_prerelease_bump: prepatch
append_to_pre_release_tag: rc
- name: Testing
if: ${{ github.event_name == 'pull_request' && github.ref == 'refs/heads/main' }}
uses: actions/setup-node@v4
with:
node-version: "18.x"
run: |
npm ci
npm t
- name: Build
if: ${{ startsWith(github.ref,'refs/heads/') || github.event_name == 'pull_request' }}
uses: docker/build-push-action@v4
with:
file: ./Dockerfile
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: ENV=prod
- name: Build and push staging version
if: ${{ ! github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v4
with:
file: ./Dockerfile
push: true
tags: |
ghcr.io/marigold-dev/tzsafe:${{ steps.tag_version.outputs.new_version}}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: ENV=dev
- name: Build and push release version
if: ${{ github.event_name == 'pull_request' && github.ref == 'refs/heads/release' }}
uses: docker/build-push-action@v4
with:
file: ./Dockerfile
push: true
tags: |
ghcr.io/marigold-dev/tzsafe:stable
ghcr.io/marigold-dev/tzsafe:${{ steps.tag_version.outputs.new_version}}-release
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: ENV=prod