forked from aeternity/dex-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (89 loc) · 2.98 KB
/
prod-docker-mainnet.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
name: Production Dex Backend Mainnet Pipeline
on:
push:
branches:
- main
env:
ENV: "prd"
APP: "dex-backend-mainnet"
concurrency: dex_backend_production_environment
jobs:
main:
runs-on: ubuntu-latest
name: Dex backend mainnet build docker
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 100
ref: ${{ github.event.pull_request.head.sha }}
- name: Get tags
run: git fetch --tags origin
- name: Get latest release tag
shell: bash
id: release_tag
run: echo TAG=$(git describe --tags HEAD --abbrev=0) >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
with:
install: true
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-${{ env.ENV }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ env.ENV }}-buildx
- name: Log in to dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: Extract metadata for docker
if: |
github.event_name == 'push' ||
startsWith(github.ref, 'refs/tags/v')
id: meta
uses: docker/metadata-action@v3
with:
images: aeternitybot/dex-backend-mainnet
tags: |
type=raw,value=${{ steps.release_tag.outputs.TAG }}
- name: Build and push docker image
if: |
github.event_name == 'push' ||
startsWith(github.ref, 'refs/tags/v')
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
- name: Move cache
if: github.event_name == 'pull_request' && github.event.action == 'opened' || github.event.action == 'synchronize'
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- uses: actions/checkout@v2
with:
repository: aeternity/gitops-apps-aelabs.git
ref: prd
token: ${{ secrets.BOT_GITHUB_TOKEN }}
persist-credentials: false
fetch-depth: 0
- name: Production Deploy
uses: aeternity/ae-github-actions/argocd-deploy@v4
with:
git-sha: ${{ steps.git-sha.outputs.GIT_SHA }}
url-prefix: ${{ steps.release_tag.outputs.TAG }}}
env: ${{ env.ENV }}
app: ${{ env.APP }}
- name: Push changes
uses: ad-m/github-push-action@master
with:
repository: aeternity/gitops-apps-aelabs
github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
branch: prd