Fix package release workflow (and remove stickerbomb) (#286) #119
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 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
outputs: | |
published: ${{ steps.changesets.outputs.published }} | |
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }} | |
steps: | |
# https://github.com/actions/checkout | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# https://github.com/actions/setup-node/ | |
- name: Setup Node.js 16.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
registry-url: https://npm.pkg.github.com | |
cache: npm | |
# Bypass husky in CI: https://typicode.github.io/husky/how-to.html#ci-server-and-docker | |
- name: Installing dependencies | |
run: npm ci | |
env: | |
HUSKY: 0 | |
# Create a temp .npmrc file so changesets doesn't use its default. | |
- name: Create CI .npmrc | |
run: | | |
cat << EOF > "$HOME/.npmrc" | |
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN} | |
registry=https://npm.pkg.github.com/ | |
always-auth=true | |
EOF | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# https://github.com/changesets/action | |
- name: Create release PR or publish | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
title: 'Chore: Publish release' | |
publish: yarn release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
notify: | |
name: Notify | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Echo outputs | |
run: echo ${{ join(fromJson(needs.release.outputs.publishedPackages).*.name, ', ') }} | |
- name: Send Tokens package notification | |
uses: stormwarning/action-release-notification@v3.1.1 | |
if: contains(fromJson(needs.release.outputs.publishedPackages).*.name, '@showbie/backpack-tokens') | |
with: | |
channel: design | |
message: A new version of *@showbie/backpack-tokens* was just released! | |
actions: '[{"text": "View changelog π", "url": "https://github.com/showbie/backpack/blob/trunk/packages/backpack-tokens/CHANGELOG.md"},{"text": "View docs π", "url": "https://design.showbie.com/"}]' | |
env: | |
SLACKBOT_TOKEN: ${{ secrets.SLACKBOT_TOKEN }} | |
- name: Send Generator package notification | |
uses: stormwarning/action-release-notification@v3.1.1 | |
if: contains(fromJson(needs.release.outputs.publishedPackages).*.name, '@showbie/generator-backpack') | |
with: | |
channel: socrative-dev | |
message: A new version of *@showbie/generator-backpack* was just released! | |
actions: '[{"text": "View changelog π", "url": "https://github.com/showbie/backpack/blob/trunk/packages/generator-backpack/CHANGELOG.md"}]' | |
env: | |
SLACKBOT_TOKEN: ${{ secrets.SLACKBOT_TOKEN }} | |
# - name: Send Stickerbomb package notification | |
# uses: stormwarning/action-release-notification@v3.1.1 | |
# if: contains(fromJson(needs.release.outputs.publishedPackages).*.name, 'stickerbomb') | |
# with: | |
# channel: socrative-dev | |
# message: A new version of *stickerbomb* was just released! | |
# actions: '[{"text": "View changelog π", "url": "https://github.com/showbie/backpack/blob/trunk/packages/stickerbomb/CHANGELOG.md"}]' | |
# env: | |
# SLACKBOT_TOKEN: ${{ secrets.SLACKBOT_TOKEN }} |