chore(main): release 0.5.0 (#112) #29
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
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
pull-requests: write | |
name: release-please | |
jobs: | |
release-please: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: tibdex/[email protected] | |
id: get_installation_token | |
with: | |
app_id: ${{ secrets.RELEASE_PLEASE_APP_ID }} | |
installation_id: ${{ secrets.RELEASE_PLEASE_APP_INSTALLATION_ID }} | |
private_key: ${{ secrets.RELEASE_PLEASE_APP_PRIVATE_KEY }} | |
- uses: google-github-actions/release-please-action@v3 | |
id: release | |
with: | |
command: manifest | |
token: ${{ steps.get_installation_token.outputs.token }} | |
# The logic below handles the npm publication | |
- uses: actions/checkout@v2 | |
if: ${{ steps.release.outputs.release_created }} | |
# The logic below handles the npm publication: | |
- 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: Get commit author | |
id: commit_author | |
run: | | |
author=$(gh pr list --search ${{ github.sha }} --state merged --json mergedBy --jq '.[0].mergedBy.login') | |
echo "author=${author}" >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ steps.get_installation_token.outputs.token }} | |
if: ${{ steps.release.outputs.release_created }} | |
- uses: actions/setup-node@v3 | |
# This sets up the .npmrc file for publishing to npm | |
with: | |
node-version: "18.x" | |
registry-url: "https://registry.npmjs.org" | |
if: ${{ steps.release.outputs.release_created }} | |
# we want the good pipefail behaviour https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell | |
- shell: bash | |
run: | | |
cd npm | |
./publish.sh | |
env: | |
NPM_TOKEN: ${{ secrets[format('NPM_TOKEN_{0}', steps.commit_author.outputs.author)] || secrets.NPM_TOKEN }} | |
OPTIC_TOKEN: ${{ secrets[format('OPTIC_TOKEN_{0}', steps.commit_author.outputs.author)] || secrets.OPTIC_TOKEN }} | |
if: ${{ steps.release.outputs.release_created }} |