Skip to content

Try github action cache docker buildx #92

Try github action cache docker buildx

Try github action cache docker buildx #92

Workflow file for this run

name: Deploy
on:
workflow_run:
workflows:
- Test
branches:
- main
- develop
types:
- completed
workflow_dispatch:
push:
branches:
- poc/docker-multi-stages
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
DOCKER_USERNAME: ${{ github.repository_owner }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
DOCKER_IMAGE: ${{ github.repository }}
jobs:
deploy:
name: Deploy application to Heroku
runs-on: ubuntu-latest
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_branch || github.ref }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set BRANCH_TAG
uses: nimblehq/branch-tag-action@v1
with:
ref: ${{ github.event.workflow_run.head_branch || github.ref }}
- name: Set HEROKU_APP env variable
run: |
if [[ $BRANCH_TAG = "latest" ]]
then
echo "HEROKU_APP=nimble-survey-web" >> $GITHUB_ENV
else
echo "HEROKU_APP=nimble-survey-web-staging" >> $GITHUB_ENV
fi
- name: Set DOCKER_IMAGE_TAG env variable
run: |

Check failure on line 57 in .github/workflows/deploy.yml

View workflow run for this annotation

GitHub Actions / Deploy

Invalid workflow file

The workflow is not valid. .github/workflows/deploy.yml (Line: 57, Col: 14): Unrecognized named-value: 'DOCKER_IMAGE'. Located at position 1 within expression: DOCKER_IMAGE
echo "DOCKER_IMAGE_TAG=${{ env.DOCKER_REGISTRY }}/${{ DOCKER_IMAGE }}:${{ BRANCH_TAG }}" >> $GITHUB_ENV
echo "MAKE UP DOCKER IMAGE TAG"
echo $DOCKER_IMAGE_TAG
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.DOCKER_IMAGE_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Log in to Heroku container
run: heroku container:login
- name: Publish application
run: |
heroku container:push --arg DOCKER_REGISTRY=$DOCKER_REGISTRY,DOCKER_IMAGE=$DOCKER_IMAGE,BRANCH_TAG=$BRANCH_TAG --recursive
heroku container:release web worker