Merge branch 'develop' #181
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)] }} | |