diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 425c0ef9..d22fc6fa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,9 +28,6 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} - if: startsWith(github.ref, 'refs/tags/v') run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV - - if: startsWith(github.ref, 'refs/tags/v') - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - if: startsWith(github.ref, 'refs/tags/v') run: | export LD_FLAGS="-w -s -X main.Version=$VERSION -X main.BuildDate=$(date "+%F-%T") -X main.Commit=$(git rev-parse --verify HEAD) -X main.Mode=prod" @@ -38,23 +35,26 @@ jobs: sudo chown -R $UID build make package-zip ls -lath build - make build-docker - docker image ls - echo "$DOCKER_PASS" | docker login --username "$DOCKER_USER" --password-stdin - echo "$DOCKER_GHCR_PASS" | docker login ghcr.io --username "$DOCKER_GHCR_USER" --password-stdin - docker push --all-tags gotify/server - docker push --all-tags gotify/server-arm7 - docker push --all-tags gotify/server-arm64 - docker push --all-tags gotify/server-riscv64 - docker push --all-tags ghcr.io/gotify/server - docker push --all-tags ghcr.io/gotify/server-arm7 - docker push --all-tags ghcr.io/gotify/server-arm64 - docker push --all-tags ghcr.io/gotify/server-riscv64 - env: - DOCKER_USER: ${{ secrets.DOCKER_USER }} - DOCKER_PASS: ${{ secrets.DOCKER_PASS }} - DOCKER_GHCR_USER: ${{ secrets.DOCKER_GHCR_USER }} - DOCKER_GHCR_PASS: ${{ secrets.DOCKER_GHCR_PASS }} + - if: startsWith(github.ref, 'refs/tags/v') + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - if: startsWith(github.ref, 'refs/tags/v') + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - if: startsWith(github.ref, 'refs/tags/v') + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_PASS }} + - if: startsWith(github.ref, 'refs/tags/v') + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ secrets.DOCKER_GHCR_USER }} + password: ${{ secrets.DOCKER_GHCR_PASS }} + - if: startsWith(github.ref, 'refs/tags/v') + run: | + make DOCKER_BUILD_PUSH=true build-docker - if: startsWith(github.ref, 'refs/tags/v') uses: svenstaro/upload-release-action@v2 with: diff --git a/Makefile b/Makefile index 5f54351b..0d812734 100644 --- a/Makefile +++ b/Makefile @@ -66,6 +66,7 @@ package-zip: extract-licenses build-docker-multiarch: require-version docker buildx build --sbom=true --provenance=true \ + $(if $(DOCKER_BUILD_PUSH),--push) \ -t gotify/server:latest \ -t gotify/server:${VERSION} \ -t gotify/server:$(shell echo $(VERSION) | cut -d '.' -f -2) \ diff --git a/docker/Dockerfile b/docker/Dockerfile index 99afaec3..1069d520 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -10,7 +10,7 @@ ARG __TARGETPLATFORM_DASHES=${TARGETPLATFORM/\//-} ARG __TARGETPLATFORM_GO_NOTATION=${__TARGETPLATFORM_DASHES/arm\/v7/arm-7} # Set the unstable tag if the target platform is not stable ARG __TARGETPLATFORM_IS_STABLE=${TARGETPLATFORM/linux\/riscv64/} -ARG __DEBIAN_HAS_STABLE_TAG=${__TARGETPLATFORM_IS_STABLE/?*/${DEBIAN}} # if the last variable is not empty, set it to the debian stable tag +ARG __DEBIAN_HAS_STABLE_TAG=${__TARGETPLATFORM_IS_STABLE/?*/${DEBIAN_STABLE_ARCH}} # if the last variable is not empty, set it to the debian stable tag ARG DEBIAN=${__DEBIAN_HAS_STABLE_TAG:-${DEBIAN_EXPERIMENTAL_ARCH}} # else set it to the debian experimental tag # --- JS Builder ---