-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (101 loc) · 3.95 KB
/
ci.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
name: Mantleplace - CI
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup docker builder
uses: docker/setup-buildx-action@v1
with: { install: true }
- name: set GitHub short sha
run: |
echo $GITHUB_SHA | head -c 8
echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | head -c 8)" >> $GITHUB_ENV
- name: Test sbt dist
uses: docker/build-push-action@v2
if: ${{ !(github.ref_type == 'tag' || (github.ref_type == 'branch' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging'))) }}
with:
target: build
push: false
cache-from: type=gha
build-args: |
APP_VERSION=${{ env.GITHUB_SHA_SHORT }}
- name: Test sbt dist (cached)
uses: docker/build-push-action@v2
if: ${{ github.ref_type == 'tag' || (github.ref_type == 'branch' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging')) }}
with:
target: build
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
APP_VERSION=${{ env.GITHUB_SHA_SHORT }}
- name: Prepare production release tags
id: meta
uses: docker/metadata-action@v3
if: ${{ github.ref_type == 'tag' }}
with:
images: |
assetmantle/mantleplace
tags: |
type=raw,value=latest-{{sha}}-{{date 'X'}}
type=raw,value=latest
- name: Prepare staging release ragas
id: meta-branch
uses: docker/metadata-action@v3
if: ${{ github.ref_type == 'branch' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }}
with:
images: |
assetmantle/mantleplace
tags: |
type=raw,value=edge-{{sha}}-{{date 'X'}}
type=raw,value=edge
- name: Prepare staging2 release ragas
id: meta-staging
uses: docker/metadata-action@v3
if: ${{ github.ref_type == 'branch' && (github.ref == 'refs/heads/staging') }}
with:
images: |
assetmantle/mantleplace
tags: |
type=raw,value=staging-{{sha}}-{{date 'X'}}
type=raw,value=staging
- name: Login to docker registry
uses: docker/login-action@v1
if: ${{ github.ref_type == 'tag' || (github.ref_type == 'branch' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging')) }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build production container image
uses: docker/build-push-action@v2
if: ${{ github.ref_type == 'tag' }}
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
APP_VERSION=${{ env.GITHUB_SHA_SHORT }}
- name: Build staging container image
uses: docker/build-push-action@v2
if: ${{ github.ref_type == 'branch' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }}
with:
push: true
tags: ${{ steps.meta-branch.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
APP_VERSION=${{ env.GITHUB_SHA_SHORT }}
- name: Build staging2 container image
uses: docker/build-push-action@v2
if: ${{ github.ref_type == 'branch' && (github.ref == 'refs/heads/staging') }}
with:
push: true
tags: ${{ steps.meta-staging.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
APP_VERSION=${{ env.GITHUB_SHA_SHORT }}