|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + publish-platform: |
| 13 | + name: Publish ${{ matrix.package_slug }} |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + - os: ubuntu-latest |
| 20 | + package_slug: coder-studio-linux-x64 |
| 21 | + - os: macos-latest |
| 22 | + package_slug: coder-studio-darwin-arm64 |
| 23 | + - os: macos-15-intel |
| 24 | + package_slug: coder-studio-darwin-x64 |
| 25 | + - os: windows-latest |
| 26 | + package_slug: coder-studio-win32-x64 |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v4 |
| 29 | + - if: startsWith(matrix.os, 'ubuntu') |
| 30 | + name: Install Linux runtime dependencies |
| 31 | + run: | |
| 32 | + sudo apt-get update |
| 33 | + sudo apt-get install -y \ |
| 34 | + build-essential \ |
| 35 | + curl \ |
| 36 | + file \ |
| 37 | + libayatana-appindicator3-dev \ |
| 38 | + libssl-dev \ |
| 39 | + libwebkit2gtk-4.1-dev \ |
| 40 | + librsvg2-dev \ |
| 41 | + patchelf \ |
| 42 | + wget |
| 43 | + - uses: dtolnay/rust-toolchain@stable |
| 44 | + - uses: pnpm/action-setup@v4 |
| 45 | + with: |
| 46 | + version: 10.32.1 |
| 47 | + - uses: actions/setup-node@v4 |
| 48 | + with: |
| 49 | + node-version: 22 |
| 50 | + cache: pnpm |
| 51 | + registry-url: 'https://registry.npmjs.org' |
| 52 | + - name: Verify tag matches package version |
| 53 | + shell: bash |
| 54 | + run: | |
| 55 | + VERSION=$(node -e "console.log(require('./packages/coder-studio/package.json').version)") |
| 56 | + test "v$VERSION" = "$GITHUB_REF_NAME" |
| 57 | + - run: pnpm install --frozen-lockfile |
| 58 | + - run: pnpm build:web |
| 59 | + - run: pnpm build:runtime |
| 60 | + - run: pnpm build:packages |
| 61 | + - run: pnpm --dir packages/${{ matrix.package_slug }} pack --pack-destination ../../.artifacts |
| 62 | + - run: npm publish packages/${{ matrix.package_slug }} --access public |
| 63 | + env: |
| 64 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 65 | + - uses: actions/upload-artifact@v4 |
| 66 | + with: |
| 67 | + name: ${{ matrix.package_slug }} |
| 68 | + path: .artifacts/*.tgz |
| 69 | + |
| 70 | + publish-main: |
| 71 | + name: Publish @spencer-kit/coder-studio |
| 72 | + needs: publish-platform |
| 73 | + runs-on: ubuntu-latest |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@v4 |
| 76 | + - uses: pnpm/action-setup@v4 |
| 77 | + with: |
| 78 | + version: 10.32.1 |
| 79 | + - uses: actions/setup-node@v4 |
| 80 | + with: |
| 81 | + node-version: 22 |
| 82 | + cache: pnpm |
| 83 | + registry-url: 'https://registry.npmjs.org' |
| 84 | + - name: Verify tag matches package version |
| 85 | + run: | |
| 86 | + VERSION=$(node -e "console.log(require('./packages/coder-studio/package.json').version)") |
| 87 | + test "v$VERSION" = "$GITHUB_REF_NAME" |
| 88 | + - run: pnpm install --frozen-lockfile |
| 89 | + - run: npm publish packages/coder-studio --access public |
| 90 | + env: |
| 91 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 92 | + |
| 93 | + github-release: |
| 94 | + name: Create GitHub Release |
| 95 | + needs: |
| 96 | + - publish-platform |
| 97 | + - publish-main |
| 98 | + runs-on: ubuntu-latest |
| 99 | + steps: |
| 100 | + - uses: actions/download-artifact@v4 |
| 101 | + with: |
| 102 | + path: .release-artifacts |
| 103 | + - uses: softprops/action-gh-release@v2 |
| 104 | + with: |
| 105 | + files: .release-artifacts/**/*.tgz |
0 commit comments