Skip to content

Commit 9bcabb1

Browse files
authored
Merge pull request #307 from consideRatio/pr/gha-security
2 parents fb2bca9 + 7b2b8f0 commit 9bcabb1

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

.github/workflows/publish.yml

+21-17
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,29 @@ jobs:
2828
steps:
2929
- uses: actions/checkout@v2
3030

31-
# Setup docker to build for multiple platforms (requires qemu).
32-
# See:
33-
# https://github.com/docker/build-push-action/tree/v2.3.0#usage
34-
# https://github.com/docker/build-push-action/blob/v2.3.0/docs/advanced/multi-platform.md
31+
# Setup docker to build for multiple platforms, see:
32+
# https://github.com/docker/build-push-action/tree/v2.4.0#usage
33+
# https://github.com/docker/build-push-action/blob/v2.4.0/docs/advanced/multi-platform.md
3534

36-
- name: Set up QEMU
37-
uses: docker/setup-qemu-action@v1
35+
- name: Set up QEMU (for docker buildx)
36+
uses: docker/setup-qemu-action@25f0500ff22e406f7191a2a8ba8cda16901ca018 # associated tag: v1.0.2
3837

39-
- name: Set up Docker Buildx
40-
uses: docker/setup-buildx-action@v1
38+
- name: Set up Docker Buildx (for multi-arch builds)
39+
uses: docker/setup-buildx-action@2a4b53665e15ce7d7049afb11ff1f70ff1610609 # associated tag: v1.1.2
4140

42-
# https://github.com/docker/login-action/tree/v1.8.0#docker-hub
43-
- name: Login to Docker Hub
44-
uses: docker/login-action@v1
41+
- name: Setup push rights to Docker Hub
42+
# This was setup by...
43+
# 1. Creating a Docker Hub service account "jupyterhubbot"
44+
# 2. Creating a access token for the service account specific to this
45+
# repository: https://hub.docker.com/settings/security
46+
# 3. Making the account part of the "bots" team, and granting that team
47+
# permissions to push to the relevant images:
48+
# https://hub.docker.com/orgs/jupyterhub/teams/bots/permissions
49+
# 4. Registering the username and token as a secret for this repo:
50+
# https://github.com/jupyterhub/configurable-http-proxy/settings/secrets/actions
4551
if: startsWith(github.ref, 'refs/tags/')
46-
with:
47-
username: ${{ secrets.DOCKERHUB_USERNAME }}
48-
password: ${{ secrets.DOCKERHUB_TOKEN }}
52+
run: |
53+
docker login -u "${{ secrets.DOCKER_USERNAME }}" -p "${{ secrets.DOCKERHUB_TOKEN }}"
4954
5055
# https://github.com/jupyterhub/action-major-minor-tag-calculator
5156
# If this is a tagged build this will return additional parent tags.
@@ -56,8 +61,7 @@ jobs:
5661
# If GITHUB_TOKEN isn't available (e.g. in PRs) returns no tags [].
5762
- name: Get list of tags
5863
id: gettags
59-
# TODO: Move to org?
60-
uses: jupyterhub/action-major-minor-tag-calculator@main
64+
uses: jupyterhub/action-major-minor-tag-calculator@v1
6165
with:
6266
githubToken: ${{ secrets.GITHUB_TOKEN }}
6367
prefix: "jupyterhub/configurable-http-proxy:"
@@ -66,7 +70,7 @@ jobs:
6670
run: echo "Docker tags ${{ steps.gettags.outputs.tags }}"
6771

6872
- name: Build and push
69-
uses: docker/build-push-action@v2
73+
uses: docker/build-push-action@e1b7f96249f2e4c8e4ac1519b9608c0d48944a1f # associated tag: v2.4.0
7074
with:
7175
platforms: linux/amd64,linux/arm64
7276
push: ${{ startsWith(github.ref, 'refs/tags/') }}

0 commit comments

Comments
 (0)