Skip to content

chore(main): enable release (#2) #1

chore(main): enable release (#2)

chore(main): enable release (#2) #1

name: Release & Publish
on:
push:
branches:
- main
jobs:
test-and-build:
name: Test & Build main
uses: ./.github/workflows/test-build.yaml
secrets: inherit
permissions:
contents: read
id-token: write
release-please:
name: Release Automation
runs-on: ubuntu-latest
needs: [test-and-build]
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
- uses: actions/github-script@v7
id: get-packages-released
env:
PATHS_RELEASED: ${{ steps.release.outputs.paths_released }}
with:
script: |
const paths = JSON.parse(process.env.PATHS_RELEASED);
const result = paths.map(path => path.split('/')[1]);
return result;
outputs:
packages-released: ${{ steps.get-packages-released.outputs.result }}
publish:
name: Publish ${{ matrix.package }}
if: ${{ needs.release-please.outputs.packages-released != '[]' }}
runs-on: ubuntu-latest
needs: [release-please]
strategy:
matrix:
package: ${{ fromJson(needs.release-please.outputs.packages-released) }}
defaults:
run:
working-directory: packages/${{ matrix.package }}
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version-file: ".bun-version"
- run: bun install --frozen-lockfile
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.package }}-dist
path: packages/${{ matrix.package }}/dist
- name: publish ${{ matrix.package }}
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}