Skip to content

Commit

Permalink
Fix package release workflow (and remove stickerbomb) (#286)
Browse files Browse the repository at this point in the history
* Move stickerbomb to legacy directory

This effectively deletes the package from all workflows in this repository
but keeps it around in case needed for future reference.

* Migrate away from Lerna

- Upgrade husky
- Replace lerna with basic npm commands

* Add changeset
  • Loading branch information
elidupuis authored Apr 22, 2024
1 parent 89adfea commit 6bde3e9
Show file tree
Hide file tree
Showing 29 changed files with 561 additions and 4,354 deletions.
5 changes: 5 additions & 0 deletions .changeset/happy-laws-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@showbie/backpack-tokens': patch
---

Upgrade package release workflow; this is just a test release
37 changes: 18 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ jobs:
steps:
# https://github.com/actions/checkout
- name: Checkout repo
uses: actions/checkout@main
uses: actions/checkout@v4
with:
fetch-depth: 0

# https://github.com/actions/setup-node/
- name: Setup Node.js 16.x
uses: actions/setup-node@v2.5.1
uses: actions/setup-node@v4
with:
node-version: 16.x
registry-url: https://npm.pkg.github.com
cache: npm

# https://github.com/bahmutov/npm-install
# Custom install command to prevent husky from installing.
- name: Install dependencies
uses: bahmutov/npm-install@v1
with:
install-command: yarn --ignore-scripts --no-audit
# 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
Expand All @@ -49,9 +49,8 @@ jobs:
id: changesets
uses: changesets/action@v1
with:
publish: yarn release
title: 'Chore: Publish release'
version: yarn version:changeset
publish: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -84,12 +83,12 @@ jobs:
env:
SLACKBOT_TOKEN: ${{ secrets.SLACKBOT_TOKEN }}

- name: Send Stickerbomb package notification
uses: stormwarning/[email protected]
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 }}
# - name: Send Stickerbomb package notification
# uses: stormwarning/[email protected]
# 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 }}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 0 additions & 13 deletions lerna.json

This file was deleted.

23 changes: 9 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@
"./packages/*"
],
"scripts": {
"bootstrap": "lerna bootstrap",
"build": "lerna run build",
"build": "npm run build --workspaces",
"changelog": "lerna-changelog",
"changeset": "changeset add",
"format": "prettier",
"release": "lerna run build && changeset publish",
"version:changeset": "changeset version && lerna run version"
},
"husky": {
"hooks": {
"pre-commit": "yarn bootstrap && lint-staged"
}
"prepare": "husky install",
"release": "npm run build && changeset publish"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": "eslint --fix",
Expand All @@ -29,8 +23,8 @@
"@babel/compat-data": "^7.9.0"
},
"dependencies": {
"@changesets/changelog-github": "0.4.0",
"@changesets/cli": "2.16.0",
"@changesets/changelog-github": "~0.5.0",
"@changesets/cli": "~2.27.0",
"@showbie/eslint-config": "3.0.x",
"@typescript-eslint/eslint-plugin": "4.14.x",
"@typescript-eslint/parser": "4.9.x",
Expand All @@ -39,15 +33,16 @@
"eslint-plugin-jest-dom": "3.2.x",
"eslint-plugin-react": "7.21.x",
"eslint-plugin-react-hooks": "4.2.x",
"husky": "4.3.x",
"import-sort-style-python": "1.0.2",
"lerna": "3.22.x",
"lerna-changelog": "1.0.x",
"lint-staged": "10.4.x",
"lint-staged": "12.2.1",
"prettier": "2.3.2",
"prettier-plugin-import-sort": "0.0.7",
"prettier-plugin-packagejson": "2.2.11"
},
"devDependencies": {
"husky": "^8.0.0"
},
"changelog": {
"repo": "showbie/backpack",
"labels": {
Expand Down
Loading

0 comments on commit 6bde3e9

Please sign in to comment.