@@ -46,26 +46,21 @@ jobs:
4646 - name : Cache cargo
4747 uses : Swatinem/rust-cache@v2
4848
49- - name : Verify version matches tag
50- run : |
51- TAG=${GITHUB_REF#refs/tags/v}
52- CARGO_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
53- if [ "$TAG" != "$CARGO_VERSION" ]; then
54- echo "ERROR: Tag version ($TAG) does not match Cargo.toml version ($CARGO_VERSION)"
55- exit 1
56- fi
57- echo "Version check passed: $CARGO_VERSION"
58-
5949 - name : Publish to crates.io
60- run : cargo publish --locked --token ${CARGO_REGISTRY_TOKEN}
50+ run : |
51+ cargo publish --locked --token ${CARGO_REGISTRY_TOKEN} || {
52+ if cargo publish --locked --token ${CARGO_REGISTRY_TOKEN} 2>&1 | grep -q "already uploaded"; then
53+ echo "Version already published to crates.io, skipping."
54+ else
55+ exit 1
56+ fi
57+ }
6158 env :
6259 CARGO_REGISTRY_TOKEN : ${{ secrets.CARGO_REGISTRY_TOKEN }}
6360
6461 build-release-binaries :
6562 name : Build Release Binaries (${{ matrix.asset_name }})
6663 runs-on : ${{ matrix.os }}
67- permissions :
68- contents : write
6964 strategy :
7065 fail-fast : false
7166 matrix :
@@ -108,6 +103,12 @@ jobs:
108103 if : matrix.target == 'x86_64-unknown-linux-musl'
109104 run : sudo apt-get install -y musl-tools
110105
106+ - name : Install OpenSSL (macOS)
107+ if : runner.os == 'macOS'
108+ run : |
109+ brew install openssl@3
110+ echo "OPENSSL_DIR=$(brew --prefix openssl@3)" >> $GITHUB_ENV
111+
111112 - name : Install Rust
112113 uses : dtolnay/rust-toolchain@stable
113114 with :
@@ -126,18 +127,15 @@ jobs:
126127 env :
127128 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
128129 run : |
129- TAG=${{ github.event.inputs.tag || github.ref_name }}
130+ TAG=" ${{ github.event.inputs.tag || github.ref_name }}"
130131 gh release upload "$TAG" \
131- target/${{ matrix.target }}/release/${{ matrix.artifact_name }}#${{ matrix.asset_name }} \
132+ " target/${{ matrix.target }}/release/${{ matrix.artifact_name }}#${{ matrix.asset_name }}" \
132133 --clobber
133134
134135 build-docker-images :
135136 name : Build and Push Docker Images
136137 runs-on : ubuntu-latest
137138 continue-on-error : true
138- permissions :
139- contents : read
140- packages : write
141139 steps :
142140 - uses : actions/checkout@v4
143141
@@ -151,9 +149,11 @@ jobs:
151149 username : ${{ github.actor }}
152150 password : ${{ secrets.GITHUB_TOKEN }}
153151
154- - name : Extract version from tag
152+ - name : Extract version
155153 id : version
156- run : echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
154+ run : |
155+ TAG="${{ github.event.inputs.tag || github.ref_name }}"
156+ echo "VERSION=${TAG#v}" >> $GITHUB_OUTPUT
157157
158158 - name : Build and push Docker image
159159 uses : docker/build-push-action@v5
@@ -171,9 +171,6 @@ jobs:
171171 name : Build and Push Operator Image
172172 runs-on : ubuntu-latest
173173 continue-on-error : true
174- permissions :
175- contents : read
176- packages : write
177174 steps :
178175 - uses : actions/checkout@v4
179176
@@ -187,9 +184,11 @@ jobs:
187184 username : ${{ github.actor }}
188185 password : ${{ secrets.GITHUB_TOKEN }}
189186
190- - name : Extract version from tag
187+ - name : Extract version
191188 id : version
192- run : echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
189+ run : |
190+ TAG="${{ github.event.inputs.tag || github.ref_name }}"
191+ echo "VERSION=${TAG#v}" >> $GITHUB_OUTPUT
193192
194193 - name : Build and push Operator image
195194 uses : docker/build-push-action@v5
@@ -207,9 +206,6 @@ jobs:
207206 name : Build and Push UI Image
208207 runs-on : ubuntu-latest
209208 continue-on-error : true
210- permissions :
211- contents : read
212- packages : write
213209 steps :
214210 - uses : actions/checkout@v4
215211
@@ -223,9 +219,11 @@ jobs:
223219 username : ${{ github.actor }}
224220 password : ${{ secrets.GITHUB_TOKEN }}
225221
226- - name : Extract version from tag
222+ - name : Extract version
227223 id : version
228- run : echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
224+ run : |
225+ TAG="${{ github.event.inputs.tag || github.ref_name }}"
226+ echo "VERSION=${TAG#v}" >> $GITHUB_OUTPUT
229227
230228 - name : Build and push UI image
231229 uses : docker/build-push-action@v5
0 commit comments