🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Publish docker images to ghcr.io (#2298)
Deluan Quintão92994efe48b7
diff --git a/.github/workflows/docker-tags.sh b/.github/workflows/docker-tags.shdeleted file mode 100755index 9256cb550..000000000--- a/.github/workflows/docker-tags.sh+++ /dev/null@@ -1,22 +0,0 @@-#!/bin/bash--GIT_TAG="${GITHUB_REF##refs/tags/}"-GIT_BRANCH="${GITHUB_REF##refs/heads/}"-GIT_SHA=$(git rev-parse --short HEAD)-PR_NUM=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")--DOCKER_IMAGE_TAG="--tag ${DOCKER_IMAGE}:sha-${GIT_SHA}"--if [[ $PR_NUM != "null" ]]; then- DOCKER_IMAGE_TAG="${DOCKER_IMAGE_TAG} --tag ${DOCKER_IMAGE}:pr-${PR_NUM}"-fi--if [[ $GITHUB_REF != "$GIT_TAG" ]]; then- DOCKER_IMAGE_TAG="${DOCKER_IMAGE_TAG} --tag ${DOCKER_IMAGE}:${GIT_TAG#v} --tag ${DOCKER_IMAGE}:latest"-elif [[ $GITHUB_REF == "refs/heads/master" ]]; then- DOCKER_IMAGE_TAG="${DOCKER_IMAGE_TAG} --tag ${DOCKER_IMAGE}:develop"-elif [[ $GIT_BRANCH = feature/* ]]; then- DOCKER_IMAGE_TAG="${DOCKER_IMAGE_TAG} --tag ${DOCKER_IMAGE}:$(echo $GIT_BRANCH | tr / -)"-fi--echo ${DOCKER_IMAGE_TAG}diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.ymlindex 786c20647..dcd3c40c4 100644--- a/.github/workflows/pipeline.yml+++ b/.github/workflows/pipeline.yml@@ -183,11 +183,42 @@ jobs:name: binariespath: dist- - name: Build the Docker image and push+ - name: Login to Docker Hubif: env.DOCKER_IMAGE != ''- env:- DOCKER_IMAGE: ${{secrets.DOCKER_IMAGE}}- DOCKER_PLATFORM: linux/amd64,linux/386,linux/arm/v6,linux/arm/v7,linux/arm64- run: |- echo ${{secrets.DOCKER_PASSWORD}} | docker login -u ${{secrets.DOCKER_USERNAME}} --password-stdin- docker buildx build --platform ${DOCKER_PLATFORM} `.github/workflows/docker-tags.sh` -f .github/workflows/pipeline.dockerfile --push .+ uses: docker/login-action@v2+ with:+ username: ${{ secrets.DOCKER_USERNAME }}+ password: ${{ secrets.DOCKER_PASSWORD }}++ - name: Login to GitHub Container Registry+ if: env.DOCKER_IMAGE != ''+ uses: docker/login-action@v2+ with:+ registry: ghcr.io+ username: ${{ github.actor }}+ password: ${{ secrets.GITHUB_TOKEN }}++ - name: Extract metadata for Docker+ if: env.DOCKER_IMAGE != ''+ id: meta+ uses: docker/metadata-action@v4+ with:+ labels: |+ maintainer=deluan+ images: |+ name=${{secrets.DOCKER_IMAGE}},enable=${{env.GITHUB_REF_TYPE == 'tag' || env.GITHUB_REF_NAME == 'master'}}+ name=ghcr.io/${{ github.repository }}+ tags: |+ type=ref,event=pr+ type=semver,pattern={{version}}+ type=raw,value=develop,enable={{is_default_branch}}++ - name: Build and Push+ if: env.DOCKER_IMAGE != ''+ uses: docker/build-push-action@v4+ with:+ context: .+ file: .github/workflows/pipeline.dockerfile+ platforms: linux/amd64,linux/386,linux/arm/v6,linux/arm/v7,linux/arm64+ push: true+ tags: ${{ steps.meta.outputs.tags }}