|
27 | 27 | run: | |
28 | 28 | git config --global --add safe.directory "$GITHUB_WORKSPACE" |
29 | 29 |
|
| 30 | + - name: Check out specified tag |
| 31 | + if: ${{ github.event.inputs.tag != '' }} |
| 32 | + run: | |
| 33 | + git fetch --tags |
| 34 | + git checkout ${{ github.event.inputs.tag }} |
| 35 | +
|
30 | 36 | - name: Build sdist |
31 | 37 | run: | |
32 | 38 | pipx run build --sdist |
|
57 | 63 | run: | |
58 | 64 | git config --global --add safe.directory "$GITHUB_WORKSPACE" |
59 | 65 |
|
| 66 | + - name: Check out specified tag |
| 67 | + if: ${{ github.event.inputs.tag != '' }} |
| 68 | + run: | |
| 69 | + git fetch --tags |
| 70 | + git checkout ${{ github.event.inputs.tag }} |
| 71 | +
|
60 | 72 | - name: Compute dev version from git |
61 | 73 | id: version |
62 | 74 | run: | |
@@ -113,14 +125,25 @@ jobs: |
113 | 125 | environment: pypi |
114 | 126 | permissions: |
115 | 127 | id-token: write |
116 | | - if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'linux-nvme/libnvme' |
| 128 | + if: (startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch') && github.repository == 'linux-nvme/libnvme' |
117 | 129 | steps: |
118 | | - - name: Check if it is a release tag |
119 | | - id: check-tag |
| 130 | + - name: Determine match status |
| 131 | + id: match |
120 | 132 | run: | |
121 | | - if [[ ${{ github.event.ref }} =~ ^refs/tags/v([0-9]+\.[0-9]+)(\.[0-9]+)?(-rc[0-9]+)?$ ]]; then |
122 | | - echo ::set-output name=match::true |
123 | | - fi |
| 133 | + VERSION="" |
| 134 | + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then |
| 135 | + VERSION="${{ github.event.inputs.tag }}" |
| 136 | + elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then |
| 137 | + VERSION="${GITHUB_REF##refs/tags/}" |
| 138 | + fi |
| 139 | +
|
| 140 | + if [[ "$VERSION" =~ ^v([0-9]+\.[0-9]+)(\.[0-9]+)?(-rc[0-9]+)?$ ]]; then |
| 141 | + echo "Tag version validated: $VERSION" |
| 142 | + echo "match=true" >> $GITHUB_OUTPUT |
| 143 | + else |
| 144 | + echo "Invalid or missing tag: $VERSION" |
| 145 | + echo "match=false" >> $GITHUB_OUTPUT |
| 146 | + fi |
124 | 147 |
|
125 | 148 | - name: Download artifiact |
126 | 149 | uses: actions/download-artifact@v4 |
|
0 commit comments