π·ββοΈ Build Release #168
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: π·ββοΈ Build Release | |
| on: | |
| workflow_run: | |
| workflows: ["tests:unit"] | |
| branches: [master] | |
| types: [completed] | |
| paths: | |
| - 'packages/**' | |
| jobs: | |
| cli-release: | |
| name: π·ββοΈ Build Release | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| strategy: | |
| matrix: | |
| node-version: [ 22.12.0 ] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| id-token: write | |
| outputs: | |
| BUILD_VERSION: ${{ steps.version.outputs.BUILD_VERSION }} | |
| steps: | |
| - name: π₯ Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: π’ Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9.10.0 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 'latest' | |
| - name: Get pnpm store directory | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
| - name: Setup pnpm cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install the packages | |
| run: pnpm i | |
| - name: π Build packages | |
| run: pnpm run build | |
| - name: π Setup npm auth | |
| run: | | |
| echo "registry=https://registry.npmjs.org" >> ~/.npmrc | |
| echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: π΅οΈ Check for changes | |
| id: version | |
| run: | | |
| # get latest commit sha | |
| SHA=$(git rev-parse HEAD) | |
| # get first 7 characters of sha | |
| SHORT_SHA=${SHA::7} | |
| BUILD_VERSION=build-${SHORT_SHA} | |
| # set output so it can be used in other jobs | |
| echo "BUILD_VERSION=${BUILD_VERSION}" >> $GITHUB_OUTPUT | |
| - name: π Publish build release | |
| run: node ./release.js --prod --snapshot ${{ steps.version.outputs.BUILD_VERSION }} | |