Skip to content

Commit

Permalink
feat: extract docker_tag from git ref.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuspod committed Dec 23, 2022
1 parent ed34421 commit d45dda3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ jobs:
runs-on: ubuntu-latest
needs: build_docker
steps:
- name: Extract docker tag
id: extract_values
run: |
GIT_REF=${{ github.event.inputs.git_ref }}
DOCKER_TAG=$([[ ${GIT_REF} == 'main' ]] && echo 'latest' || echo ${GIT_REF})
echo "docker_tag=${DOCKER_TAG}" >> $GITHUB_OUTPUT
- name: Deploy to prod
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PROD_HOST }}
username: ${{ secrets.PROD_USERNAME }}
key: ${{ secrets.PROD_KEY }}
port: ${{ secrets.PROD_PORT }}
script: cd yearn-exporter-api && git pull && ./deploy.sh ${{ github.event.inputs.git_ref }}
script: cd yearn-exporter-api && git pull && ./deploy.sh ${{ steps.extract_values.outputs.docker_tag }}
8 changes: 7 additions & 1 deletion .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ jobs:
runs-on: ubuntu-latest
needs: build_docker
steps:
- name: Extract docker tag
id: extract_values
run: |
GIT_REF=${{ github.event.inputs.git_ref }}
DOCKER_TAG=$([[ ${GIT_REF} == 'main' ]] && echo 'latest' || echo ${GIT_REF})
echo "docker_tag=${DOCKER_TAG}" >> $GITHUB_OUTPUT
- name: Deploy to staging
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.STAGING_HOST }}
username: ${{ secrets.STAGING_USERNAME }}
key: ${{ secrets.STAGING_KEY }}
port: ${{ secrets.STAGING_PORT }}
script: cd yearn-exporter-api && git pull && ./deploy.sh ${{ github.event.inputs.git_ref }}
script: cd yearn-exporter-api && git pull && ./deploy.sh ${{ steps.extract_values.outputs.docker_tag }}

0 comments on commit d45dda3

Please sign in to comment.