Skip to content

Commit

Permalink
コンテナレジストリ変更
Browse files Browse the repository at this point in the history
  • Loading branch information
na2na-p committed Oct 29, 2024
1 parent d702a53 commit de3e9b6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
31 changes: 22 additions & 9 deletions .github/workflows/cd-for-misskey-na2na.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,35 @@ jobs:
- name: Check Docker Hub
id: check_docker_hub
run: |
DOCKER_HUB_TAGS=$(curl -s https://registry.hub.docker.com/v2/repositories/na2na/misskey-na2na/tags | jq -r '.results[] | .name')
if [ $(echo $DOCKER_HUB_TAGS | grep -c $MISSKEY_VERSION) -eq 1 ]; then
echo "Tag $MISSKEY_VERSION already exists on Docker Hub."
else
echo "Tag $MISSKEY_VERSION does not exist on Docker Hub."
echo "tag_exists=false" >> $GITHUB_OUTPUT
echo "MISSKEY_VERSION=$MISSKEY_VERSION" >> $GITHUB_OUTPUT
fi
digests=$(curl -s 'https://registry.na2na.dev/api/v2.0/projects/misskey/repositories/misskey-na2na/artifacts?with_tag=false&with_label=false&with_scan_overview=false&with_sbom_overview=false&with_signature=false&with_immutable_status=false&with_accessory=false' | jq -r '.[].digest')
is_exists=false
check_tag_exists() {
local digest=$1
local version=$2
tags=$(curl -s "https://registry.na2na.dev/api/v2.0/projects/misskey/repositories/misskey-na2na/artifacts/$digest/tags" | jq -r '.[].name')
if echo "$tags" | grep -q "^$version$"; then
is_exists=true
echo "Tag $version already exists for digest $digest."
return 0
else
echo "Tag $version does not exist for digest $digest."
is_exists=false
echo "MISSKEY_VERSION=$version" >> $GITHUB_OUTPUT
fi
}
for digest in $digests; do
check_tag_exists "$digest" "$MISSKEY_VERSION"
done
echo "tag_exists=$is_exists" >> $GITHUB_OUTPUT
echo "MISSKEY_VERSION=$MISSKEY_VERSION" >> $GITHUB_OUTPUT
Build-and-Push-to-Docker-Hub:
needs:
- Prepare
if: ${{ needs.Prepare.outputs.tag_exists == 'false' }}
with:
MISSKEY_VERSION: ${{ needs.Prepare.outputs.MISSKEY_VERSION }}
IMAGE_REPOSITORY: na2na
IMAGE_REPOSITORY: misskey
IMAGE_NAME: misskey-na2na
uses: ./.github/workflows/image-push-for-misskey-na2na-release.yml
secrets: inherit
9 changes: 5 additions & 4 deletions .github/workflows/image-push-for-misskey-na2na-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.na2na.dev
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build Docker Image
run: |
docker buildx bake \
-f 'infra/web/image-bake.hcl' \
--builder="${{ steps.buildx.outputs.name }}" \
--set='web.tags=${{ inputs.IMAGE_REPOSITORY }}/${{ inputs.IMAGE_NAME }}:${{ inputs.MISSKEY_VERSION }}' \
--set='web.tags=${{ inputs.IMAGE_REPOSITORY }}/${{ inputs.IMAGE_NAME }}:${{ steps.prepare-for-build.outputs.sha_short }}' \
--set='web.tags=registry.na2na.dev/${{ inputs.IMAGE_REPOSITORY }}/${{ inputs.IMAGE_NAME }}:${{ inputs.MISSKEY_VERSION }}' \
--set='web.tags=registry.na2na.dev/${{ inputs.IMAGE_REPOSITORY }}/${{ inputs.IMAGE_NAME }}:${{ steps.prepare-for-build.outputs.sha_short }}' \
--push

0 comments on commit de3e9b6

Please sign in to comment.