fix: ifAssociativeArray
serialization
#109
This file contains 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: release-please | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
find-changes: | |
runs-on: ubuntu-latest | |
outputs: | |
packages: ${{ steps.changes.outputs.packages }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: changes | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const { execSync } = require('child_process'); | |
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/'); | |
const latestRelease = await github.repos.getLatestRelease({ owner, repo }); | |
execSync('git pull --tags'); | |
const diff = execSync(`git diff --name-only tags/${latestRelease.data.tag_name}`, { encoding: 'utf-8'}); | |
const packages = [...new Set([...diff.matchAll(/^packages\/(.+?)\//mg)].map(group => group[1]))] | |
console.log(`::set-output name=packages::${JSON.stringify(Array.from(packages))}`); | |
release-please: | |
runs-on: ubuntu-latest | |
needs: find-changes | |
if: needs['find-changes'].outputs.packages != '[]' | |
strategy: | |
fail-fast: false | |
matrix: | |
package: ${{ fromJson(needs['find-changes'].outputs.packages) }} | |
steps: | |
- uses: google-github-actions/release-please-action@v3 | |
id: release | |
with: | |
release-type: node | |
monorepo-tags: true | |
path: packages/${{ matrix.package }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
package-name: ${{ matrix.package }} | |
- uses: actions/checkout@v3 | |
if: ${{ steps.release.outputs.releases_created }} | |
- uses: actions/setup-node@v3 | |
if: ${{ steps.release.outputs.releases_created }} | |
with: | |
node-version: 20.x | |
registry-url: https://registry.npmjs.org | |
- run: npm install | |
if: ${{ steps.release.outputs.releases_created }} | |
- run: npm run build --if-present -w packages/${{ matrix.package }}/ | |
if: ${{ steps.release.outputs.releases_created }} | |
- run: npm publish packages/${{ matrix.package }}/ --access public | |
if: ${{ steps.release.outputs.releases_created }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |