-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
release: automate the release for this project (#194)
- Loading branch information
Showing
8 changed files
with
157 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
|
||
name: npm/publish | ||
description: common build tasks for npm publish | ||
|
||
inputs: | ||
node-version: | ||
description: 'Nodejs version' | ||
required: false | ||
default: 'v18.20.2' | ||
package: | ||
description: 'The npm package' | ||
required: true | ||
npm-token: | ||
description: 'The NPMJS token' | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 'v18.20.2' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- run: npm ci --ignore-scripts | ||
shell: 'bash' | ||
|
||
- name: npm publish | ||
working-directory: ./packages/${{ inputs.package}} | ||
run: npm publish | ||
shell: 'bash' | ||
env: | ||
# https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages#publishing-packages-to-the-npm-registry | ||
NODE_AUTH_TOKEN: ${{ inputs.npm-token }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Release a tagged version of the '@elastic/ecs-helpers' package. | ||
name: release-ecs-helpers | ||
|
||
on: | ||
push: | ||
tags: | ||
- ecs-helpers-v*.*.* | ||
|
||
# 'id-token' perm needed for npm publishing with provenance (see | ||
# https://docs.npmjs.com/generating-provenance-statements#example-github-actions-workflow) | ||
permissions: | ||
contents: write | ||
pull-requests: read | ||
id-token: write | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: ./.github/actions/npm-publish | ||
with: | ||
node-version: 'v18.20.2' | ||
npm-token: 'ecs-helpers' | ||
package: ${{ matrix.package }} | ||
|
||
- name: Notify in Slack | ||
if: ${{ failure() }} | ||
uses: elastic/oblt-actions/slack/notify-result@v1 | ||
with: | ||
bot-token: ${{ secrets.SLACK_BOT_TOKEN }} | ||
channel-id: "#apm-agent-node" | ||
message: '[${{ github.repository }}] Release `@elastic/ecs-helpers` *${{ github.ref_name }}*' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Release a tagged version of the '@elastic/ecs-[...]-format' packages. | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v*.*.* | ||
|
||
# 'id-token' perm needed for npm publishing with provenance (see | ||
# https://docs.npmjs.com/generating-provenance-statements#example-github-actions-workflow) | ||
permissions: | ||
contents: write | ||
pull-requests: read | ||
id-token: write | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
package: ["ecs-morgan-format", "ecs-pino-format", "ecs-winston-format"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: ./.github/actions/npm-publish | ||
with: | ||
node-version: 'v18.20.2' | ||
npm-token: ${{ secrets.NPM_TOKEN }} | ||
package: ${{ matrix.package }} | ||
|
||
notify: | ||
runs-on: ubuntu-latest | ||
needs: [release] | ||
steps: | ||
- id: check | ||
uses: elastic/oblt-actions/check-dependent-jobs@v1 | ||
with: | ||
jobs: ${{ toJSON(needs) }} | ||
- name: Notify in Slack | ||
# Only notify on failure, because on success the published GitHub | ||
# Release will result in a notification from the GitHub Slack app | ||
# (assuming '/github subscribe elastic/elastic-otel-node'). | ||
if: ${{ steps.check.outputs.status == 'failure' }} | ||
uses: elastic/oblt-actions/slack/[email protected] | ||
with: | ||
bot-token: ${{ secrets.SLACK_BOT_TOKEN }} | ||
channel-id: "#apm-agent-node" | ||
message: '[${{ github.repository }}] Release `@elastic/ecs-[...]-format` packages *${{ github.ref_name }}*' |
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
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
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
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
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