diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 8a3c1b7..9688452 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,7 +1,5 @@ name: Publish Docker image on: - push: - branches: release: types: [published] @@ -12,10 +10,32 @@ jobs: steps: - name: Check out the repo uses: actions/checkout@v2 - - name: Push to Docker Hub - uses: docker/build-push-action@v1 + - + name: Sanitize Repo Name for Tagging + run: echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]' | (read; echo REPO_LOWER=$REPLY) >> $GITHUB_ENV + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to Docker Hub + uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - repository: stjude/xenocp - tag_with_ref: true + - + name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ secrets.GH_USERNAME }} + password: ${{ secrets.GH_TOKEN }} + - name: Build and Push + uses: docker/build-push-action@v2 + with: + push: true + tags: | + ghcr.io/${{ env.REPO_LOWER }}:${{ github.event.release.tag_name }} + ${{ env.REPO_LOWER }}:${{ github.event.release.tag_name }} diff --git a/.github/workflows/docker_branches.yml b/.github/workflows/docker_branches.yml new file mode 100644 index 0000000..d701a1f --- /dev/null +++ b/.github/workflows/docker_branches.yml @@ -0,0 +1,42 @@ +name: Publish Docker image +on: + push: + branches-ignore: + - 'master' + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + - + name: Sanitize Repo Name for Tagging + run: echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]' | (read; echo REPO_LOWER=$REPLY) >> $GITHUB_ENV + - + name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.REPO_LOWER }} + tags: | + type=ref,event=branch,prefix=branch- + type=ref,event=pr + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Push to Docker Hub + uses: docker/build-push-action@v2 + with: + push: true + tags: ${{ steps.meta.outputs.tags }}