Skip to content

Commit

Permalink
feat(workflows): switch to an integrated release-and-publish workflow
Browse files Browse the repository at this point in the history
this is needed because events triggered by a GITHUB_TOKEN do not create new workflow runs.

a sad day for automation 🥲
  • Loading branch information
aimeerivers committed Nov 28, 2023
1 parent 04bb608 commit 545e670
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 71 deletions.
49 changes: 0 additions & 49 deletions .github/workflows/publish-please.yml

This file was deleted.

62 changes: 62 additions & 0 deletions .github/workflows/release-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Release and Publish

on:
workflow_call:
secrets:
READONLY_NPM_TOKEN:
description: Needed to install private @hedia npm packages
required: true
PUBLISHING_NPM_TOKEN:
description: Needed to publish @hedia npm packages
required: true

permissions:
contents: write
pull-requests: write

jobs:
release-and-publish:
runs-on: ubuntu-latest
if: >
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' &&
github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'autorelease: pending')
)
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node

- if: steps.release.outputs.release_created == 'true'
name: Checkout Repository
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
fetch-depth: 1

- if: steps.release.outputs.release_created == 'true'
name: Setup Node.js Environment
uses: actions/setup-node@v3
with:
node-version-file: "package.json"
always-auth: true
registry-url: https://registry.npmjs.org
scope: "@hedia"

- if: steps.release.outputs.release_created == 'true'
name: Install Dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.READONLY_NPM_TOKEN }}

- if: steps.release.outputs.release_created == 'true'
name: Build
run: npm run build --if-present

- if: steps.release.outputs.release_created == 'true'
name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.PUBLISHING_NPM_TOKEN }}
22 changes: 0 additions & 22 deletions .github/workflows/release-please.yml

This file was deleted.

0 comments on commit 545e670

Please sign in to comment.