0
0

Migrate from Docker Hub to ghcr.io for CI builds

This commit is contained in:
caipira113 2024-08-19 22:55:11 +09:00
parent a312a744f9
commit 285371c639
No known key found for this signature in database

View File

@ -7,7 +7,7 @@ on:
workflow_dispatch:
env:
REGISTRY_IMAGE: misskey/misskey
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}
jobs:
# see https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners
@ -20,7 +20,8 @@ jobs:
platform:
- linux/amd64
- linux/arm64
if: github.repository == 'misskey-dev/misskey'
outputs:
commit_sha: ${{ steps.git.outputs.commit_sha }}
steps:
- name: Prepare
run: |
@ -28,13 +29,17 @@ jobs:
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Check out the repo
uses: actions/checkout@v4.1.1
- name: Get commit sha
id: git
run: echo "commit_sha=$(git rev-parse --short=7 HEAD)" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
- name: Log in to Container registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
@ -73,16 +78,18 @@ jobs:
merge-multiple: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
- name: Log in to Container registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create --tag ${{ env.REGISTRY_IMAGE }}:develop \
docker buildx imagetools create --tag ${{ env.REGISTRY_IMAGE }}:develop --tag ${{ env.REGISTRY_IMAGE }}::${{needs.build.outputs.commit_sha}} \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:develop
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{needs.build.outputs.commit_sha}}