diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 82137ae..5b7b1a4 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -9,6 +9,9 @@ on: jobs: docker: runs-on: ubuntu-latest + permissions: + contents: write + packages: write steps: - name: Checkout @@ -22,7 +25,9 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: moonrailgun/tianji + images: | + moonrailgun/tianji + ghcr.io/moonrailgun/tianji tags: | type=semver,pattern={{version}} - name: Login to DockerHub @@ -31,6 +36,13 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Log into ghcr.io registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build and push