diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ae6d05908..31d0874be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,20 +30,14 @@ permissions: jobs: semver: runs-on: ubuntu-latest - outputs: - version: ${{ steps.version.outputs.semver }} steps: - uses: actions/github-script@v7 - id: version with: script: | - const r = /(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/; - if (!r.test("${{ github.event.release.tag_name }}")) { - core.setFailed(`invalid semver`); + const r = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/; + if (!r.test("${{ github.event.inputs.version }}")) { + core.setFailed(`Action failed with an invalid semver.`); } - const matches = "${{ github.event.release.tag_name }}".match(r); - console.log(matches); - core.setOutput('semver', matches[0]); binary: strategy: matrix: @@ -120,7 +114,7 @@ jobs: push: true platforms: "linux/${{ matrix.platform }}" file: ./docker/binary_release.Dockerfile - tags: tensorchord/pgvecto-rs-binary:pg${{ matrix.version }}-v${{ needs.semver.outputs.version }}-${{ matrix.platform }} + tags: tensorchord/pgvecto-rs-binary:pg${{ matrix.version }}-v${{ github.event.inputs.version }}-${{ matrix.platform }} docker_release: needs: ["docker_binary_release", "semver"] runs-on: ubuntu-latest @@ -133,13 +127,13 @@ jobs: uses: actions/checkout@v4 - name: Variables id: variables - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | if ("${{ matrix.rootless }}" == "true") { - core.setOutput('tags', "tensorchord/pgvecto-rs:pg${{ matrix.version }}-v${{ needs.semver.outputs.version }}-rootless"); + core.setOutput('tags', "tensorchord/pgvecto-rs:pg${{ matrix.version }}-v${{ github.event.inputs.version }}-rootless"); } else { - core.setOutput('tags', "tensorchord/pgvecto-rs:pg${{ matrix.version }}-v${{ needs.semver.outputs.version }}"); + core.setOutput('tags', "tensorchord/pgvecto-rs:pg${{ matrix.version }}-v${{ github.event.inputs.version }}"); } - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -159,7 +153,7 @@ jobs: platforms: "linux/amd64,linux/arm64" file: ./docker/pgvecto-rs.Dockerfile build-args: | - FROM_TAG=pg${{ matrix.version }}-v${{ needs.semver.outputs.version }} + FROM_TAG=pg${{ matrix.version }}-v${{ github.event.inputs.version }} POSTGRES_VERSION=${{ matrix.version }} tags: ${{ steps.variables.outputs.tags }} - name: Push postgres with pgvecto.rs to Docker Registry(rootless) @@ -171,6 +165,6 @@ jobs: platforms: "linux/amd64,linux/arm64" file: ./docker/pgvecto-rs-rootless.Dockerfile build-args: | - FROM_TAG=pg${{ matrix.version }}-v${{ needs.semver.outputs.version }} + FROM_TAG=pg${{ matrix.version }}-v${{ github.event.inputs.version }} POSTGRES_VERSION=${{ matrix.version }} - tags: ${{ steps.variables.outputs.tags }} + tags: ${{ steps.variables.outputs.tags }} \ No newline at end of file