Skip to content

Commit 74e002c

Browse files
committed
Move to GitHub Container Registry
Docker Hub was planning to sunset their free plan: https://www.docker.com/developers/free-team-faq/. Although they have backed down from doing this, it still seems better to centralize our infrastructure dependencies on GitHub.
1 parent 3f1b7a2 commit 74e002c

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

.github/workflows/build.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
name: Build
1+
name: html-build CI
22
on:
33
pull_request:
4-
branches:
5-
- main
4+
branches: ['main']
65
push:
7-
branches:
8-
- main
6+
branches: ['main']
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
913
jobs:
1014
build:
1115
name: Build
12-
runs-on: ubuntu-22.04
13-
env:
14-
IMAGE_NAME: whatwg/html-build
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
1520
steps:
1621
- name: Checkout whatwg/html-build
1722
uses: actions/checkout@v3
@@ -37,12 +42,13 @@ jobs:
3742
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
3843
uses: docker/login-action@v2
3944
with:
40-
username: ${{ secrets.DOCKER_HUB_USERNAME }}
41-
password: ${{ secrets.DOCKER_HUB_TOKEN }}
45+
registry: ${{ env.REGISTRY }}
46+
username: ${{ github.actor }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
4248
- name: Docker push
4349
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
4450
run: |
45-
docker tag "$IMAGE_NAME" "$IMAGE_NAME:$GITHUB_SHA"
46-
docker tag "$IMAGE_NAME" "$IMAGE_NAME:latest"
47-
docker push "$IMAGE_NAME:$GITHUB_SHA"
48-
docker push "$IMAGE_NAME:latest"
51+
docker tag "$REGISTRY/$IMAGE_NAME" "$REGISTRY/$IMAGE_NAME:$GITHUB_SHA"
52+
docker tag "$REGISTRY/$IMAGE_NAME" "$REGISTRY/$IMAGE_NAME:latest"
53+
docker push "$REGISTRY/$IMAGE_NAME:$GITHUB_SHA"
54+
docker push "$REGISTRY/$IMAGE_NAME:latest"

ci-build/docker-build.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ function main {
2222
cd "$TMP_DIR"
2323
trap cleanTemp EXIT
2424

25-
local docker_hub_repo="whatwg/html-build"
25+
local ghcr_repo="ghcr.io/whatwg/html-build"
2626

27-
# Build the Docker image, using Docker Hub as a cache. (This will be fast if nothing has changed
27+
# Build the Docker image, using GHCR as a cache. (This will be fast if nothing has changed
2828
# in html-build or its dependencies).
2929
docker pull ghcr.io/whatwg/wattsi
30-
docker pull "$docker_hub_repo" || true
31-
docker build --cache-from "$docker_hub_repo" --tag "$docker_hub_repo" .
30+
docker pull "$ghcr_repo" || true
31+
docker build --cache-from "$ghcr_repo" --tag "$ghcr_repo" .
3232
}
3333

3434
function cleanTemp {

ci-build/docker-run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ docker run --rm --mount "type=bind,source=$HTML_SOURCE,destination=/whatwg/html,
1111
--env "HTML_SOURCE=/whatwg/html" \
1212
--mount "type=bind,source=$HTML_OUTPUT,destination=/whatwg/output" \
1313
--env "HTML_OUTPUT=/whatwg/output" \
14-
whatwg/html-build
14+
ghcr.io/whatwg/html-build

0 commit comments

Comments
 (0)