diff --git a/.github/workflows/build-syncthing.yaml b/.github/workflows/build-syncthing.yaml index b301e4766..c79125c8c 100644 --- a/.github/workflows/build-syncthing.yaml +++ b/.github/workflows/build-syncthing.yaml @@ -665,6 +665,24 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - name: Set version tags + run: | + version=$(go run build.go version) + version=${version#v} + if [[ $version == @([0-9]|[0-9][0-9]).@([0-9]|[0-9][0-9]).@([0-9]|[0-9][0-9]) ]] ; then + echo Release version, pushing to :latest and version tags + major=${version%.*.*} + minor=${version%.*} + tags=syncthing/syncthing:$version,syncthing/syncthing:$major,syncthing/syncthing:$minor,syncthing/syncthing:latest ) + elif [[ $version == *-rc.@([0-9]|[0-9][0-9]) ]] ; then + echo Release candidate, pushing to :rc + tags=syncthing/syncthing:rc + else + echo Development version, pushing to :edge + tags=syncthing/syncthing:edge + fi + echo "DOCKER_TAGS=$tags" >> $GITHUB_ENV + - name: Build and push syncthing uses: docker/build-push-action@v4 with: @@ -672,4 +690,4 @@ jobs: file: ./Dockerfile platforms: linux/amd64,linux/arm64 push: true - tags: syncthing/syncthing:edge + tags: ${{ env.DOCKER_TAGS }}