Skip to content

Merge pull request #620 from codex-team/update-workflow #420

Merge pull request #620 from codex-team/update-workflow

Merge pull request #620 from codex-team/update-workflow #420

name: Build and push docker image
on: [push]
env:
DOCKER_REPO: ${{ secrets.DOCKER_USERNAME }}/hawk-garage
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Make stage envfile
if: endsWith(github.ref, '/stage')
uses: SpicyPizza/create-envfile@v1
with:
envkey_VUE_APP_HAWK_TOKEN: ${{ secrets.HAWK_TOKEN_STAGE }}
envkey_VUE_APP_AMPLITUDE_TOKEN: ${{ secrets.AMPLITUDE_TOKEN_STAGE }}
envkey_VUE_APP_CLOUDPAYMENTS_PUBLIC_ID: ${{ secrets.CP_PUBLIC_ID_STAGE }}
envkey_VUE_APP_API_ENDPOINT: "https://api.stage.hawk.so"
- name: Make prod envfile
if: endsWith(github.ref, '/prod')
uses: SpicyPizza/create-envfile@v1
with:
envkey_VUE_APP_HAWK_TOKEN: ${{ secrets.HAWK_TOKEN_PROD }}
envkey_VUE_APP_AMPLITUDE_TOKEN: ${{ secrets.AMPLITUDE_TOKEN_PROD }}
envkey_VUE_APP_CLOUDPAYMENTS_PUBLIC_ID: ${{ secrets.CP_PUBLIC_ID_PROD }}
envkey_VUE_APP_API_ENDPOINT: "https://api.hawk.so"
- name: Make prod envfile
if: endsWith(github.ref, '/prod-ru')
uses: SpicyPizza/create-envfile@v1
with:
envkey_VUE_APP_HAWK_TOKEN: ${{ secrets.HAWK_TOKEN_PROD }}
envkey_VUE_APP_AMPLITUDE_TOKEN: ${{ secrets.AMPLITUDE_TOKEN_PROD }}
envkey_VUE_APP_CLOUDPAYMENTS_PUBLIC_ID: ${{ secrets.CP_PUBLIC_ID_PROD }}
envkey_VUE_APP_API_ENDPOINT: "https://api.hawk-tracker.ru"
- name: Build and push docker image
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ${{ env.DOCKER_REPO }}
tag_with_ref: true
push: ${{ endsWith(github.ref, '/stage') || endsWith(github.ref, '/prod') || endsWith(github.ref, '/prod-ru') }}