-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (49 loc) · 2.17 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
name: Build and deploy
on:
push:
branches:
- master
- develop
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'info'
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: pull latest code
uses: actions/checkout@v2
- name: build step
run: docker build -t ghcr.io/dedogmadao/dt-frontend/dt-frontend:${{ github.ref_name }}-latest .
- name: login to docker registry
run: echo ${{ secrets.PERSONAL_GITHUB_TOKEN }} | docker login ghcr.io -u flokibb --password-stdin
- name: push docker image to package registry
run: docker push ghcr.io/dedogmadao/dt-frontend/dt-frontend:${{ github.ref_name }}-latest
environ_step:
needs: build_and_push
runs-on: ubuntu-latest
outputs:
prefix: ${{ steps.env_step.outputs.env_prefix }}
steps:
- name: Check out current repository and set ENV
id: env_step
run: if [ "${{ github.ref }}" == 'refs/heads/develop' ]; then echo "::set-output name=env_prefix::STAGE_"; else echo "::set-output name=env_prefix::PROD_"; fi
deploy:
needs: environ_step
uses: dedogmadao/dd-reusable-actions/.github/workflows/action.yml@master
with:
REPOSITORY_NAME: dt-frontend
secrets:
REF_NAME: ${{ secrets[format('{0}DOMAIN', needs.environ_step.outputs.prefix)] }}
SSH_ACTION_HOST: ${{ secrets[format('{0}SSH_ACTION_HOST', needs.environ_step.outputs.prefix)] }}
SSH_ACTION_USER: ${{ secrets[format('{0}SSH_ACTION_USER', needs.environ_step.outputs.prefix)] }}
SSH_ACTION_KEY: ${{ secrets[format('{0}SSH_ACTION_KEY', needs.environ_step.outputs.prefix)] }}
SSH_ACTION_PORT: ${{ secrets[format('{0}SSH_ACTION_PORT', needs.environ_step.outputs.prefix)] }}
DOMAIN: ${{ secrets[format('{0}DOMAIN', needs.environ_step.outputs.prefix)] }}
BRANCH: ${{ github.ref_name }}
PERSONAL_GITHUB_TOKEN: ${{ secrets['PERSONAL_GITHUB_TOKEN'] }}
BACKEND_URL: ${{ secrets[format('{0}BACKEND_URL', needs.environ_step.outputs.prefix)] }}
ROBOTS_TXT: ${{ secrets[format('{0}ROBOTS_TXT_FILE', needs.environ_step.outputs.prefix)] }}