Skip to content

Commit

Permalink
chore: setup for the first release
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomontalbano committed Dec 16, 2022
1 parent 2a02e44 commit 8119535
Show file tree
Hide file tree
Showing 7 changed files with 21,837 additions and 9,536 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Publish

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Node 🧰
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'npm'

- name: Install 📦
run: npm ci

- name: Build 🛠
run: npm run build:types

- name: Publish 🚀 PRERELEASE
if: 'github.event.release.prerelease'
run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
./node_modules/.bin/lerna publish from-git --dist-tag next --require-scripts --yes
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish 🚀 PRODUCTION
if: '!github.event.release.prerelease'
run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
./node_modules/.bin/lerna publish from-git --require-scripts --yes
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Post to a Slack channel
id: slack
uses: slackapi/slack-github-action@v1.23.0
with:
# Slack channel id, channel name, or user id to post message.
# See also: https://api.slack.com/methods/chat.postMessage#channels
# channel-id: 'pipeline'
# For posting a rich message using Block Kit
payload: |
{
"text": "New release ${{github.ref_name}} for ${{github.event.repository.name}}.",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "New release for <${{github.event.repository.html_url}}|`${{github.event.repository.name}}`>\n*<${{github.event.release.html_url}}|release notes>*"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Project:*\n${{github.event.repository.name}}"
},
{
"type": "mrkdwn",
"text": "*Version:*\n${{github.ref_name}}"
}
]
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "${{github.event.sender.avatar_url}}",
"alt_text": "${{github.event.sender.login}}"
},
{
"type": "mrkdwn",
"text": "*${{github.event.sender.login}}* has triggered this release."
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.PIPELINE_SLACK_CHANNEL_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
21 changes: 21 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release

on:
push:
tags: ["v*"]

jobs:
github_release:
name: Trigger GitHub release
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Create a draft GitHub release 🎁
uses: ncipollo/release-action@v1
with:
draft: true
prerelease: ${{ contains(github.ref, 'beta.') }}
generateReleaseNotes: true
discussionCategory: Announcements
5 changes: 5 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"useWorkspaces": true,
"version": "0.0.0"
}
Loading

0 comments on commit 8119535

Please sign in to comment.