Skip to content

Commit

Permalink
fix build, push to ghcr
Browse files Browse the repository at this point in the history
  • Loading branch information
robkooper committed Nov 17, 2020
1 parent 221ec23 commit a6f5219
Showing 1 changed file with 24 additions and 17 deletions.
41 changes: 24 additions & 17 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,43 +57,50 @@ jobs:
TAGS="$BRANCH"
fi
TAGS="${TAGS},${BRANCH}-${{ github.run_number }}"
echo "::set-env name=TAGS::${TAGS}"
echo "::set-env name=GITHUB_BRANCH::${BRANCH}"
echo "TAGS=${TAGS}" >> $GITHUB_ENV
echo "GITHUB_BRANCH=${BRANCH}" >> $GITHUB_ENV
# build the docker image, this will always run to make sure
# the Dockerfile still works.
- name: Build image
run: |
docker build \
--file ${{ matrix.DOCKERFILE }} \
--build-arg BRANCH=${GITHUB_BRANCH} \
--build-arg BUILDNUMBER=${{ github.run_number }} \
--build-arg GITSHA1=${{ github.sha }} \
--tag image \
${{ matrix.FOLDER }}
uses: elgohr/Publish-Docker-Github-Action@2.22
env:
BRANCH: ${{ env.GITHUB_BRANCH }}
BUILDNUMBER: ${{ github.run_number }}
GITSHA1: ${{ github.sha }}
with:
registry: docker.pkg.github.com
dockerfile: ${{ matrix.DOCKERFILE }}
context: ${{ matrix.FOLDER }}
name: ${{ github.repository_owner }}/${{ github.event.repository.name }}/frontend
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
tags: "${{ env.TAGS }}"
buildargs: BRANCH,BUILDNUMBER,GITSHA1
no_push: true

# this will publish to the actor (person) github packages
- name: Publish to GitHub
if: github.event_name == 'push'
uses: elgohr/Publish-Docker-Github-Action@2.21
if: github.event_name == 'push' && github.repository == env.MASTER_REPO
uses: elgohr/Publish-Docker-Github-Action@2.22
env:
BRANCH: ${{ env.GITHUB_BRANCH }}
BUILDNUMBER: ${{ github.run_number }}
GITSHA1: ${{ github.sha }}
with:
name: ${{ github.repository_owner }}/WebAPI/${{ matrix.IMAGE }}
registry: ghcr.io
name: ${{ github.repository_owner }}/${{ matrix.IMAGE }}
dockerfile: ${{ matrix.DOCKERFILE }}
context: ${{ matrix.FOLDER }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_PASSWORD }}
tags: "${{ env.TAGS }}"
registry: docker.pkg.github.com
buildargs: BRANCH,BUILDNUMBER,GITSHA1

# this will publish to the classtranscribe dockerhub repo
- name: Publish to Docker Hub
if: github.event_name == 'push' && github.repository == env.MASTER_REPO
uses: elgohr/Publish-Docker-Github-Action@2.21
uses: elgohr/Publish-Docker-Github-Action@2.22
env:
BRANCH: ${{ env.GITHUB_BRANCH }}
BUILDNUMBER: ${{ github.run_number }}
Expand Down

0 comments on commit a6f5219

Please sign in to comment.