|
| 1 | +name: CRC VSIX Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [allquixotic] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: crc-vsix-release-${{ github.ref }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-vsix-release: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + permissions: |
| 16 | + contents: write |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + fetch-depth: 0 |
| 23 | + |
| 24 | + - name: Setup Node.js and pnpm |
| 25 | + uses: ./.github/actions/setup-node-pnpm |
| 26 | + with: |
| 27 | + install-args: "--frozen-lockfile" |
| 28 | + |
| 29 | + - name: Package Extension |
| 30 | + id: package |
| 31 | + run: | |
| 32 | + package_name=$(node -p "require('./src/package.json').name") |
| 33 | + current_package_version=$(node -p "require('./src/package.json').version") |
| 34 | + rm -f bin/*.vsix |
| 35 | +
|
| 36 | + pnpm vsix |
| 37 | +
|
| 38 | + vsix_path="bin/${package_name}-${current_package_version}.vsix" |
| 39 | + if [ ! -f "$vsix_path" ]; then |
| 40 | + echo "Expected VSIX package was not produced: $vsix_path" |
| 41 | + exit 1 |
| 42 | + fi |
| 43 | +
|
| 44 | + unzip -l "$vsix_path" > /tmp/crc-vsix-contents.txt |
| 45 | +
|
| 46 | + grep -q "extension/package.json" /tmp/crc-vsix-contents.txt || exit 1 |
| 47 | + grep -q "extension/package.nls.json" /tmp/crc-vsix-contents.txt || exit 1 |
| 48 | + grep -q "extension/dist/extension.js" /tmp/crc-vsix-contents.txt || exit 1 |
| 49 | + grep -q "extension/webview-ui/audio/celebration.wav" /tmp/crc-vsix-contents.txt || exit 1 |
| 50 | + grep -q "extension/webview-ui/build/assets/index.js" /tmp/crc-vsix-contents.txt || exit 1 |
| 51 | + grep -q "extension/assets/codicons/codicon.ttf" /tmp/crc-vsix-contents.txt || exit 1 |
| 52 | + grep -q "extension/assets/vscode-material-icons/icons/3d.svg" /tmp/crc-vsix-contents.txt || exit 1 |
| 53 | +
|
| 54 | + rm /tmp/crc-vsix-contents.txt |
| 55 | +
|
| 56 | + echo "version=${current_package_version}" >> "$GITHUB_OUTPUT" |
| 57 | + echo "vsix_name=$(basename "$vsix_path")" >> "$GITHUB_OUTPUT" |
| 58 | + echo "vsix_path=${vsix_path}" >> "$GITHUB_OUTPUT" |
| 59 | +
|
| 60 | + - name: Upload VSIX artifact |
| 61 | + uses: actions/upload-artifact@v4 |
| 62 | + with: |
| 63 | + name: crc-vsix-${{ steps.package.outputs.version }} |
| 64 | + path: ${{ steps.package.outputs.vsix_path }} |
| 65 | + if-no-files-found: error |
| 66 | + |
| 67 | + - name: Refresh GitHub prerelease |
| 68 | + env: |
| 69 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + PACKAGE_VERSION: ${{ steps.package.outputs.version }} |
| 71 | + RELEASE_TAG: crc-allquixotic-latest |
| 72 | + RELEASE_TITLE: CRC allquixotic latest |
| 73 | + VSIX_PATH: ${{ steps.package.outputs.vsix_path }} |
| 74 | + run: | |
| 75 | + notes_file=$(mktemp) |
| 76 | +
|
| 77 | + cat > "$notes_file" <<EOF |
| 78 | + Automated downloadable VSIX build for the allquixotic branch. |
| 79 | +
|
| 80 | + Extension version: ${PACKAGE_VERSION} |
| 81 | + Commit: ${GITHUB_SHA} |
| 82 | + Workflow run: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} |
| 83 | + EOF |
| 84 | +
|
| 85 | + if gh release view "$RELEASE_TAG" >/dev/null 2>&1; then |
| 86 | + gh release delete "$RELEASE_TAG" --yes --cleanup-tag |
| 87 | + fi |
| 88 | +
|
| 89 | + gh release create "$RELEASE_TAG" \ |
| 90 | + "$VSIX_PATH" \ |
| 91 | + --target "$GITHUB_SHA" \ |
| 92 | + --title "$RELEASE_TITLE" \ |
| 93 | + --prerelease \ |
| 94 | + --notes-file "$notes_file" |
0 commit comments