From 59c6e781499b0f5c13c58df7e1cdfde38a4d6e27 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Fri, 5 May 2023 15:08:51 +0900 Subject: [PATCH] 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. --- .github/workflows/build.yml | 65 ++++++++++++++++++++++--------------- Makefile | 3 +- README.md | 27 +++++++-------- 3 files changed, 54 insertions(+), 41 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 14dde0e..2bbe699 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,40 +1,53 @@ -name: Build +name: Wattsi CI on: pull_request: - branches: - - main + branches: ['main'] push: - branches: - - main + branches: ['main'] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: build: name: Build - runs-on: ubuntu-22.04 - env: - IMAGE_NAME: whatwg/wattsi + runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 with: fetch-depth: 0 - - name: docker build - run: make docker - # This also serves as a *very* minimal test of the executable. - - name: docker run (get version) + - name: Create version file run: | - WATTSI_VERSION=$(docker run "$IMAGE_NAME" --version | cut -d' ' -f2) - echo "WATTSI_VERSION=$WATTSI_VERSION" >> $GITHUB_ENV - - name: docker tag + git rev-list --count HEAD > src/version.inc + - name: Build + uses: docker/build-push-action@v4 + with: + context: . + load: true + tags: ${{ env.IMAGE_NAME }}:test + - name: Test + # This minimal test also saves the version for us to use as a tag. run: | - docker tag "$IMAGE_NAME" "$IMAGE_NAME:$WATTSI_VERSION" - docker tag "$IMAGE_NAME" "$IMAGE_NAME:latest" - - name: docker login + WATTSI_VERSION=$(docker run "$IMAGE_NAME:test" --version | cut -d' ' -f2) + echo "WATTSI_VERSION=$WATTSI_VERSION" >> $GITHUB_ENV + - name: Login if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_TOKEN }} - - name: docker push + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - run: | - docker push "$IMAGE_NAME:$WATTSI_VERSION" - docker push "$IMAGE_NAME:latest" + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.WATTSI_VERSION }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest diff --git a/Makefile b/Makefile index bbe7731..4ecb389 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,7 @@ clean: docker: git rev-list --count HEAD > src/version.inc - docker pull whatwg/wattsi || true - docker build --pull --cache-from whatwg/wattsi --tag whatwg/wattsi . + docker build --tag whatwg/wattsi . manual: git rev-list --count HEAD > src/version.inc diff --git a/README.md b/README.md index b6491ab..efb2b8e 100644 --- a/README.md +++ b/README.md @@ -5,17 +5,18 @@ Wattsi is a build tool for creating the [HTML Standard](https://html.spec.whatwg ## Features Currently: - * Number the sections - * Create Table of Contents - * Cross-reference `` and `` to `` - * Create small TOC - * Cross-reference back (`` menu) - * Strip out unused references - * Check for missing references - * Spec splitting - * Add output for `` elements - * Add MDN annotations - * Add syntax-highlighting markup to `
` contents
+
+* Number the sections
+* Create Table of Contents
+* Cross-reference `` and `` to ``
+* Create small TOC
+* Cross-reference back (`` menu)
+* Strip out unused references
+* Check for missing references
+* Spec splitting
+* Add output for `` elements
+* Add MDN annotations
+* Add syntax-highlighting markup to `
` contents
 
 ## Wattsi syntax
 
@@ -23,10 +24,10 @@ For documentation on the "Wattsi language", e.g. things like `data-x` or `w-node
 
 ## Building and running Wattsi with Docker
 
-The easiest way to use Wattsi is via [Docker](https://www.docker.com/). Once you have Docker, you can download and run a copy of Wattsi from [Docker Hub](https://hub.docker.com/r/whatwg/wattsi) using
+The easiest way to use Wattsi is via [Docker](https://www.docker.com/). Once you have Docker, you can download and run a copy of Wattsi from the [GitHub Container Registry](https://github.com/whatwg/wattsi/pkgs/container/wattsi) using
 
 ```bash
-docker run whatwg/wattsi
+docker run ghcr.io/whatwg/wattsi
 ```
 
 The [HTML build tools](https://github.com/whatwg/html-build) will automatically attempt to use this form if they cannot find a locally-installed copy of Wattsi.