Skip to content

fix: typo in README (#80) #53

fix: typo in README (#80)

fix: typo in README (#80) #53

Workflow file for this run

on:
push:
branches:
- main
name: release
jobs:
changeFinder:
runs-on: ubuntu-latest
outputs:
nodePaths: ${{ steps.interrogate.outputs.nodePaths }}
steps:
- uses: actions/checkout@v2
- id: interrogate
uses: actions/github-script@v4
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
});
console.log(`latest release: ${JSON.stringify(latestRelease.data)}`);
execSync('git pull --tags');
execSync(`git reset --hard ${latestRelease.data.tag_name}`);
const status = execSync(`git diff --name-only origin/main`, { encoding: 'utf-8'});
console.log(status);
const changes = status.split('\n');
let nodePaths = new Set();
for (const change of changes) {
if (change.startsWith('packages/')) {
const [,library] = change.split('/');
nodePaths.add(library);
};
}
nodePaths = Array.from(nodePaths);
if(nodePaths.length === 0){
console.log(`::warning::No changes found, release will be skipped.`)
}
console.log(`::set-output name=nodePaths::${JSON.stringify(nodePaths)}`);
release-pr:
runs-on: ubuntu-latest
needs: changeFinder
if: ${{ fromJson(needs.changeFinder.outputs.nodePaths)[0] != '' }}
strategy:
fail-fast: false
matrix:
package: ${{fromJson(needs.changeFinder.outputs.nodePaths)}}
steps:
- uses: google-github-actions/release-please-action@v2
id: release-please
with:
path: packages/${{ matrix.package }}
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
package-name: "@web-std/${{ matrix.package }}"
monorepo-tags: true
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"refactor","section":"Changes","hidden":false},{"type":"chore","section":"Changes","hidden":false}]'
command: release-pr
release:
runs-on: ubuntu-latest
needs: changeFinder
if: ${{ fromJson(needs.changeFinder.outputs.nodePaths)[0] != '' }}
strategy:
fail-fast: false
matrix:
package: ${{fromJson(needs.changeFinder.outputs.nodePaths)}}
steps:
- uses: GoogleCloudPlatform/release-please-action@v2
id: release
with:
path: packages/${{ matrix.package }}
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
package-name: "@web-std/${{ matrix.package }}"
monorepo-tags: true
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"refactor","section":"Changes","hidden":false},{"type":"chore","section":"Changes","hidden":false}]'
command: github-release
# The logic below handles the npm publication:
- name: Checkout
uses: actions/checkout@v2
# these if statements ensure that a publication only occurs when
# a new release is created:
if: ${{ steps.release.outputs.release_created }}
- name: Setup
uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org/
if: ${{ steps.release.outputs.release_created }}
- name: Install
uses: bahmutov/npm-install@v1
if: ${{ steps.release.outputs.release_created }}
- name: Publish
if: ${{ steps.release.outputs.release_created }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
run: |
cd packages/${{ matrix.package }}
npm publish --access=public