|
| 1 | +name: Release Please |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + pull-requests: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + release-please: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + release_created: ${{ steps.release.outputs.release_created }} |
| 17 | + tag_name: ${{ steps.release.outputs.tag_name }} |
| 18 | + steps: |
| 19 | + - uses: googleapis/release-please-action@v4 |
| 20 | + id: release |
| 21 | + with: |
| 22 | + release-type: node |
| 23 | + package-name: '@trogonstack/aipm' |
| 24 | + config-file: .github/release-please-config.json |
| 25 | + manifest-file: .github/release-please-manifest.json |
| 26 | + changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"docs","section":"Documentation","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":true},{"type":"refactor","section":"Code Refactoring","hidden":false},{"type":"test","section":"Tests","hidden":true},{"type":"ci","section":"CI/CD","hidden":true}]' |
| 27 | + |
| 28 | + build-and-publish: |
| 29 | + needs: release-please |
| 30 | + if: ${{ needs.release-please.outputs.release_created }} |
| 31 | + runs-on: ${{ matrix.os }} |
| 32 | + strategy: |
| 33 | + matrix: |
| 34 | + include: |
| 35 | + - os: ubuntu-latest |
| 36 | + target: linux |
| 37 | + artifact: aipm-linux-x64 |
| 38 | + - os: macos-latest |
| 39 | + target: darwin |
| 40 | + artifact: aipm-darwin-x64 |
| 41 | + - os: macos-latest |
| 42 | + target: darwin-arm |
| 43 | + artifact: aipm-darwin-arm64 |
| 44 | + - os: windows-latest |
| 45 | + target: windows |
| 46 | + artifact: aipm-windows-x64.exe |
| 47 | + |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + |
| 51 | + - name: Setup Bun |
| 52 | + uses: oven-sh/setup-bun@v2 |
| 53 | + with: |
| 54 | + bun-version: latest |
| 55 | + |
| 56 | + - name: Install dependencies |
| 57 | + run: bun install --frozen-lockfile |
| 58 | + |
| 59 | + - name: Build executable |
| 60 | + run: bun run build:${{ matrix.target }} |
| 61 | + |
| 62 | + - name: Create tarball (Unix) |
| 63 | + if: matrix.os != 'windows-latest' |
| 64 | + run: | |
| 65 | + cd dist |
| 66 | + tar -czf ${{ matrix.artifact }}.tar.gz ${{ matrix.artifact }} |
| 67 | +
|
| 68 | + - name: Create zip (Windows) |
| 69 | + if: matrix.os == 'windows-latest' |
| 70 | + run: | |
| 71 | + cd dist |
| 72 | + Compress-Archive -Path ${{ matrix.artifact }} -DestinationPath ${{ matrix.artifact }}.zip |
| 73 | +
|
| 74 | + - name: Upload to Release |
| 75 | + uses: softprops/action-gh-release@v1 |
| 76 | + with: |
| 77 | + tag_name: ${{ needs.release-please.outputs.tag_name }} |
| 78 | + files: | |
| 79 | + dist/${{ matrix.artifact }}.tar.gz |
| 80 | + dist/${{ matrix.artifact }}.zip |
| 81 | + env: |
| 82 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 83 | + |
| 84 | + npm-publish: |
| 85 | + needs: release-please |
| 86 | + if: ${{ needs.release-please.outputs.release_created }} |
| 87 | + runs-on: ubuntu-latest |
| 88 | + steps: |
| 89 | + - uses: actions/checkout@v4 |
| 90 | + |
| 91 | + - name: Setup Bun |
| 92 | + uses: oven-sh/setup-bun@v2 |
| 93 | + with: |
| 94 | + bun-version: latest |
| 95 | + |
| 96 | + - name: Install dependencies |
| 97 | + run: bun install --frozen-lockfile |
| 98 | + |
| 99 | + - name: Run CI checks |
| 100 | + run: bun run ci |
| 101 | + |
| 102 | + - name: Setup Node.js for npm |
| 103 | + uses: actions/setup-node@v4 |
| 104 | + with: |
| 105 | + node-version: '20' |
| 106 | + registry-url: 'https://registry.npmjs.org' |
| 107 | + |
| 108 | + - name: Publish to npm |
| 109 | + run: npm publish --access public |
| 110 | + env: |
| 111 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments