From 4e8c1e2afab0929c0d679a3e36b1e633d5c85e18 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 1 Apr 2023 08:32:10 +0200 Subject: [PATCH] Change docker registry to ghcr.io --- .github/workflows/pr.yml | 2 +- .github/workflows/push_image.yml | 60 +++++++++++++++++++------------- Dockerfile | 2 +- Dockerfile.buildlocal | 2 +- README.md | 6 ++-- 5 files changed, 41 insertions(+), 31 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 38fe07e..1a37c9e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -9,7 +9,7 @@ jobs: - uses: actions/checkout@v2 - name: clang-format run: | - docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source ./include + docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./source ./include build-lib: runs-on: ubuntu-22.04 needs: clang-format diff --git a/.github/workflows/push_image.yml b/.github/workflows/push_image.yml index defc003..2ff2aaf 100644 --- a/.github/workflows/push_image.yml +++ b/.github/workflows/push_image.yml @@ -3,31 +3,41 @@ on: push: branches: - main + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: - clang-format: + build-and-push-image: runs-on: ubuntu-22.04 + permissions: + contents: read + packages: write + steps: - - uses: actions/checkout@v2 - - name: clang-format - run: | - docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source ./include - build: - runs-on: ubuntu-latest - needs: clang-format - steps: - - uses: actions/checkout@master - - name: Get release version - id: get_release_tag - run: | - echo RELEASE_VERSION=$(echo $(date '+%Y%m%d')) >> $GITHUB_ENV - echo REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//" | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV - echo REPOSITORY_OWNER=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $1}' | sed 's/[^a-zA-Z0-9]//g' | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV - - name: Publish to Registry - uses: elgohr/Publish-Docker-Github-Action@master - with: - name: ${{ env.REPOSITORY_OWNER }}/${{ env.REPOSITORY_NAME }} - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - snapshot: true - cache: true - tags: "latest, ${{ env.RELEASE_VERSION }}" + - name: Checkout repository + uses: actions/checkout@v2 + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value={{date 'YYYYMMDD'}}-{{sha}} + type=raw,value={{date 'YYYYMMDD'}} + type=raw,value=latest + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@v2.1.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.CI_PAT_WRITE_PACKAGE }} + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + push: true \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 0ce290d..c928143 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM wiiuenv/devkitppc:20220806 +FROM ghcr.io/wiiu-env/devkitppc:20220806 WORKDIR tmp_build COPY . . diff --git a/Dockerfile.buildlocal b/Dockerfile.buildlocal index 66d345c..bad125d 100644 --- a/Dockerfile.buildlocal +++ b/Dockerfile.buildlocal @@ -1,3 +1,3 @@ -FROM wiiuenv/devkitppc:20220806 +FROM ghcr.io/wiiu-env/devkitppc:20220806 WORKDIR project diff --git a/README.md b/README.md index f1711f6..3307cd7 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,12 @@ After that you can simply include ``, call `C A prebuilt version of this lib can found on dockerhub. To use it for your projects, add this to your Dockerfile. ``` [...] -COPY --from=wiiuenv/libcontentredirection:[tag] /artifacts $DEVKITPRO +COPY --from=ghcr.io/wiiu-env/libcontentredirection:[tag] /artifacts $DEVKITPRO [...] ``` -Replace [tag] with a tag you want to use, a list of tags can be found [here](https://hub.docker.com/r/wiiuenv/libcontentredirection/tags). +Replace [tag] with a tag you want to use, a list of tags can be found [here](https://github.com/wiiu-env/libcontentredirection/pkgs/container/libcontentredirection/versions). It's highly recommended to pin the version to the **latest date** instead of using `latest`. ## Format the code via docker -`docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./source ./include -i` +`docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./source ./include -i`