aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Sebastiaan Zeeff <[email protected]>2020-11-14 19:44:34 +0100
committerGravatar Sebastiaan Zeeff <[email protected]>2020-11-14 19:44:34 +0100
commit98800896d14b60c567d4c6f7f1b6e2f40f3f84d3 (patch)
treed84f93addff3626e51ff598eacf65f7d7e8b542e
parentAdd documentation to GitHub Actions steps (diff)
Push container to both DockerHub and GHCR
To make the transition easier, we push the Docker container to both DockerHub and the GitHub Container Registry. I've also added a secondary tag by short commit SHA. Signed-off-by: Sebastiaan Zeeff <[email protected]>
-rw-r--r--.github/workflows/lint-test-build.yml24
1 files changed, 22 insertions, 2 deletions
diff --git a/.github/workflows/lint-test-build.yml b/.github/workflows/lint-test-build.yml
index dc4ea5fd9..a5a930912 100644
--- a/.github/workflows/lint-test-build.yml
+++ b/.github/workflows/lint-test-build.yml
@@ -123,6 +123,12 @@ jobs:
runs-on: ubuntu-latest
steps:
+ # Create a commit SHA-based tag for the container repositories
+ - name: Create SHA Container Tag
+ id: sha_tag
+ run: |
+ tag=$(cut -c 1-7 <<< $GITHUB_SHA)
+ echo "::set-output name=tag::$tag"
- name: Checkout code
uses: actions/checkout@v2
@@ -135,11 +141,25 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
+ - name: Login to Github Container Registry
+ uses: docker/login-action@v1
+ with:
+ registry: ghcr.io
+ username: ${{ github.repository_owner }}
+ password: ${{ secrets.GHCR_TOKEN }}
+
+ # This step currently pushes to both DockerHub and GHCR to
+ # make the migration easier. The DockerHub push will be
+ # removed once we've migrated to our K8s cluster.
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
- cache-from: type=registry,ref=pythondiscord/bot:latest
- tags: pythondiscord/bot:latest
+ cache-from: type=registry,ref=ghcr.io/python-discord/bot:latest
+ tags: |
+ ghcr.io/python-discord/bot:latest
+ ghcr.io/python-discord/bot:${{ steps.sha_tag.outputs.tag }}
+ pythondiscord/bot:latest
+ pythondiscord/bot:${{ steps.sha_tag.outputs.tag }}