|
17 | 17 | required: true
|
18 | 18 | type: string
|
19 | 19 | default: latest
|
| 20 | + publish_cratesio: |
| 21 | + description: "Publish to crates.io" |
| 22 | + required: true |
| 23 | + type: boolean |
| 24 | + default: true |
| 25 | + publish_docker: |
| 26 | + description: "Publish Docker image" |
| 27 | + required: true |
| 28 | + type: boolean |
| 29 | + default: true |
| 30 | + publish_powershell: |
| 31 | + description: "Publish PowerShell install script" |
| 32 | + required: true |
| 33 | + type: boolean |
| 34 | + default: true |
20 | 35 |
|
21 | 36 | env:
|
22 | 37 | _AZ_REGISTRY: bitwardenprod.azurecr.io
|
@@ -45,15 +60,15 @@ jobs:
|
45 | 60 | - name: Checkout repo
|
46 | 61 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
47 | 62 |
|
48 |
| - # - name: Branch check |
49 |
| - # if: ${{ inputs.release_type != 'Dry Run' }} |
50 |
| - # run: | |
51 |
| - # if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then |
52 |
| - # echo "===================================" |
53 |
| - # echo "[!] Can only release from the 'main' branch" |
54 |
| - # echo "===================================" |
55 |
| - # exit 1 |
56 |
| - # fi |
| 63 | + - name: Branch check |
| 64 | + if: ${{ inputs.release_type != 'Dry Run' }} |
| 65 | + run: | |
| 66 | + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then |
| 67 | + echo "===================================" |
| 68 | + echo "[!] Can only release from the 'main' branch" |
| 69 | + echo "===================================" |
| 70 | + exit 1 |
| 71 | + fi |
57 | 72 |
|
58 | 73 | - name: Version output
|
59 | 74 | id: version-output
|
|
93 | 108 | env:
|
94 | 109 | _VERSION: ${{ needs.setup.outputs.release_version }}
|
95 | 110 | _TAG_NAME: ${{ needs.setup.outputs.release_tag }}
|
| 111 | + if: ${{ inputs.publish_cratesio }} |
96 | 112 | steps:
|
97 | 113 | - name: Checkout
|
98 | 114 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
@@ -139,6 +155,7 @@ jobs:
|
139 | 155 | security-events: write
|
140 | 156 | id-token: write
|
141 | 157 | needs: setup
|
| 158 | + if: ${{ inputs.publish_docker }} |
142 | 159 |
|
143 | 160 | steps:
|
144 | 161 | - name: Checkout
|
@@ -234,23 +251,88 @@ jobs:
|
234 | 251 |
|
235 | 252 |
|
236 | 253 | publish-powershell:
|
237 |
| - name: Publish docker versioned and latest image |
| 254 | + name: Publish to bitwarden.com/install |
238 | 255 | runs-on: ubuntu-24.04
|
239 | 256 | permissions:
|
240 | 257 | security-events: write
|
241 | 258 | id-token: write
|
242 | 259 | needs: setup
|
| 260 | + if: ${{ inputs.publish_powershell}} |
| 261 | + env: |
| 262 | + _EXPECTED_VERSION: ${{ needs.setup.outputs.release_version }} |
| 263 | + _ACCOUNT_NAME: bwsecretsmanager7g3o |
| 264 | + _CONTAINER_NAME: $web |
243 | 265 | steps:
|
| 266 | + |
| 267 | + - name: Checkout |
| 268 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 269 | + |
244 | 270 | - name: Log in to Azure
|
245 | 271 | uses: bitwarden/gh-actions/azure-login@main
|
246 | 272 | with:
|
247 | 273 | subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
248 | 274 | tenant_id: ${{ secrets.AZURE_TENANT_ID }}
|
249 | 275 | client_id: ${{ secrets.AZURE_CLIENT_ID }}
|
250 |
| - |
| 276 | + |
251 | 277 | - name: Print Version
|
| 278 | + env: |
| 279 | + ACCOUNT_NAME: bwsecretsmanager7g3o |
| 280 | + CONTAINER_NAME: $web |
| 281 | + run: | |
| 282 | + echo "Version: $EXPECTED_VERSION" && \ |
| 283 | + az storage blob list \ |
| 284 | + --account-name $ACCOUNT_NAME \ |
| 285 | + --container-name $CONTAINER_NAME \ |
| 286 | + --query "[].name" |
| 287 | +
|
| 288 | + - name: Test upload PowerShell install script |
| 289 | + run: | |
| 290 | + for file in crates/bws/scripts/*; do |
| 291 | + base=$(basename "$file") |
| 292 | + name="${base%.*}-prerelease.${base##*.}" |
| 293 | + echo "Uploading $file as $name" |
| 294 | + az storage blob upload \ |
| 295 | + --account-name $ACCOUNT_NAME \ |
| 296 | + --container-name $CONTAINER_NAME \ |
| 297 | + --file "$file" \ |
| 298 | + --name "$name" \ |
| 299 | + --overwrite true |
| 300 | + done |
| 301 | +
|
| 302 | + - name: Test install of prerelease script |
| 303 | + run: | |
| 304 | + # Download install script to home dir |
| 305 | + curl -sSL https://bws.bitwarden.com/install-prerelease.sh -o ~/install-prerelease.sh |
| 306 | +
|
| 307 | + # Make it executable |
| 308 | + chmod +x ~/install-prerelease.sh |
| 309 | +
|
| 310 | + # Run it with sudo |
| 311 | + sudo ~/install-prerelease.sh |
| 312 | +
|
| 313 | + INSTALLED_VERSION=$(bws --version) |
| 314 | + echo "Installed bws version: $INSTALLED_VERSION" |
| 315 | + echo "Expected bws version: $EXPECTED_VERSION" |
| 316 | +
|
| 317 | + if [ "$INSTALLED_VERSION" != "bws $EXPECTED_VERSION" ]; then |
| 318 | + echo "❌ Version mismatch! Expected $EXPECTED_VERSION but got $INSTALLED_VERSION" |
| 319 | + exit 1 |
| 320 | + fi |
| 321 | + |
| 322 | + - name: Publish PowerShell install script |
| 323 | + if: ${{ inputs.release_type != 'Dry Run' && success() }} |
252 | 324 | run: |
|
253 |
| - echo "Version: ${{ needs.setup.outputs.release_version }}" |
| 325 | + for file in crates/bws/scripts/*; do |
| 326 | + base=$(basename "$file") |
| 327 | + prerelease_name="${base%.*}-prerelease.${base##*.}" |
| 328 | + release_name="${base%.*}.${base##*.}" |
| 329 | + echo "Copying $prerelease_name to $release_name in Azure Blob Storage" |
| 330 | + az storage blob copy start \ |
| 331 | + --account-name $ACCOUNT_NAME \ |
| 332 | + --destination-container $CONTAINER_NAME \ |
| 333 | + --destination-blob "$release_name" \ |
| 334 | + --source-uri "https://${ACCOUNT_NAME}.blob.core.windows.net/${CONTAINER_NAME}/${prerelease_name}" |
| 335 | + done |
254 | 336 |
|
255 | 337 | - name: Log out from Azure
|
256 | 338 | uses: bitwarden/gh-actions/azure-logout@main
|
|
0 commit comments