This repository has been archived by the owner on Jul 25, 2024. It is now read-only.
Update README.md #196
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 | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
release-please: | |
name: 'Create release' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: google-github-actions/release-please-action@v3 | |
id: release | |
with: | |
release-type: node | |
command: manifest | |
token: ${{secrets.GITHUB_TOKEN}} | |
default-branch: main | |
# The logic below handles the npm publication: | |
- name: Checkout Repository | |
with: | |
# We need to fetch all branches and commits so that Nx affected has a base to compare against. | |
fetch-depth: 0 | |
uses: actions/checkout@v4 | |
# these if statements ensure that a publication only occurs when | |
# a new release is created: | |
if: ${{ steps.release.outputs.releases_created }} | |
- name: Derive appropriate SHAs for base and head for `nx affected` commands | |
uses: nrwl/nx-set-shas@v3 | |
with: | |
main-branch-name: ${{ env.BASE }} | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 16 | |
registry-url: 'https://registry.npmjs.org' | |
always-auth: true | |
- name: Yarn install | |
run: yarn install --immutable --immutable-cache | |
# for security reasons, use --check-cache if accepting PRs from third-parties. | |
if: ${{ steps.release.outputs.releases_created }} | |
- run: echo "Release ${{ steps.release.outputs['libs/sdk--tag_name'] }} created for sdk." | |
if: ${{ steps.release.outputs['libs/sdk--release_created'] }} | |
- name: "Publish NPM SDK package: ${{ steps.release.outputs['libs/sdk--tag_name'] }}" | |
run: yarn nx publish sdk --base=${{ env.NX_BASE }} --head=${{ env.NX_HEAD }} | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
if: ${{ steps.release.outputs['libs/sdk--release_created'] }} | |
- name: "Publish NPM SDK React provider package: ${{ steps.release.outputs['libs/sdk-react-provider--tag_name'] }}" | |
run: yarn nx publish sdk-react-provider --base=${{ env.NX_BASE }} --head=${{ env.NX_HEAD }} | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
if: ${{ steps.release.outputs['libs/sdk-react-provider--release_created'] }} | |
- name: Debug | |
run: | | |
echo '${{ steps.release.outputs.tag_name }}' | |
echo '${{ steps.release.outputs.releases_created || false }}' | |
echo '${{ toJson(steps.release.outputs) }}' | |
echo '${{ steps.release.outputs.pr-branch }}' | |
echo '${{ toJson(steps.release.outputs.pr)['.headBranchName'] }}' | |
echo '${{ steps.release.outputs.sha }}' | |
outputs: | |
releases_created: ${{ steps.release.outputs.releases_created }} | |
sdk_releases_created: ${{ steps.release.outputs['libs/sdk--release_created'] }} | |
tag_name: ${{ steps.release.outputs.tag_name }} | |
package_names: ${{ steps.release.outputs.package_names }} | |
sdk_path: ${{ steps.release.outputs['libs/sdk--path'] }} | |
echo: | |
needs: [release-please] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Debug | |
run: | | |
echo '${{ needs.release-please.outputs.releases_created || false }}' | |
echo '${{ needs.release-please.outputs.sdk_releases_created }}' | |
deploy-static: | |
name: Trigger static pages deploy | |
needs: [release-please] | |
if: ${{ needs.release-please.outputs.sdk_releases_created }} | |
uses: ./.github/workflows/pages.yml |