Skip to content

Commit

Permalink
actions: Added push to ghcr.io.
Browse files Browse the repository at this point in the history
Added push to ghcr.io.
Subject to add cycle over versions too.
  • Loading branch information
vasilev authored Dec 29, 2020
1 parent de8ab7a commit 28fd840
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- v*

jobs:
# Push image to Package Registries (GitHub and DockerHub).
# Push image to Package Registries (GitHub Packages, ghcr.io, and DockerHub).
build-and-push:
runs-on: ubuntu-latest
if: github.event_name == 'push'
Expand All @@ -20,6 +20,7 @@ jobs:
- name: Log into registries
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
echo "${{ secrets.GHCR_PASSWORD }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Push image
Expand All @@ -32,11 +33,18 @@ jobs:
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag vasilev/palemoon $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
docker tag vasilev/palemoon vasilev/palemoon:$VERSION
docker push vasilev/palemoon:$VERSION
docker push vasilev/palemoon:latest
IMAGENAME='vasilev/palemoon'
for REPO in '' 'ghcr.io/'
do
REPO_IMAGENAME=$REPO$IMAGENAME
VERSIONED_IMAGENAME="$REPO_IMAGENAME:$VERSION"
echo VERSIONED_IMAGENAME=$VERSIONED_IMAGENAME
docker tag $IMAGENAME $REPO_IMAGENAME
docker tag $IMAGENAME $VERSIONED_IMAGENAME
docker push $REPO_IMAGENAME:latest
docker push $VERSIONED_IMAGENAME
done

0 comments on commit 28fd840

Please sign in to comment.