diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index a8072e0..cfc4273 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -6,14 +6,16 @@ on: # Publish semver tags as releases. tags: [ 'v*.*.*' ] -env: - IMAGE_NAME: seedgou/zerotier-moon - jobs: build: runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: - name: Checkout repository uses: actions/checkout@v2 @@ -27,20 +29,29 @@ jobs: uses: docker/setup-buildx-action@v1 - - name: Login to DockerHub + name: Login to Docker Hub if: github.event_name != 'pull_request' uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} + - + name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker # https://github.com/docker/metadata-action - name: Extract Docker metadata id: meta uses: docker/metadata-action@v3 with: - images: ${{ env.IMAGE_NAME }} + images: seedgou/zerotier-moon,ghcr.io/seedgou/zerotier-moon # Build and push Docker image with Buildx (don't push on PR) # https://github.com/docker/build-push-action