Merge pull request #378 from spotify/rugvip/publish

set up package publishing
This commit is contained in:
Patrik Oldsberg
2020-03-25 15:48:59 +01:00
committed by GitHub
11 changed files with 108 additions and 6 deletions
+3 -2
View File
@@ -17,10 +17,11 @@ jobs:
name: Node ${{ matrix.node-version }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: find location of yarn cache
- name: find location of global yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
- name: cache global yarn cache
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
+3 -2
View File
@@ -19,10 +19,11 @@ jobs:
- uses: actions/checkout@v2
- name: fetch branch master
run: git fetch origin master
- name: find location of yarn cache
- name: find location of global yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
- name: cache global yarn cache
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
+54
View File
@@ -0,0 +1,54 @@
name: Master Build
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
env:
CI: true
steps:
- uses: actions/checkout@v2
- name: find location of global yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: cache global yarn cache
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: cache node_modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
- name: use node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/ # Needed for auth
- run: yarn install
- run: yarn lint
- run: yarn build
- run: yarn test
# Publishes current version of packages that are not already present in the registry
- name: publish
run: npx --no-install lerna publish from-package --yes
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Tags the commit with the version in the core package if the tag doesn't exist
- uses: Klemensas/action-autotag@1.2.3
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
package_root: "packages/core"
tag_prefix: "v"
+1
View File
@@ -5,3 +5,4 @@ Check out [https://backstage.io]() or see the table of content below.
- [Architecture and terminology](architecture-terminology.md)
- [Getting started](getting-started/README.md)
- [References](reference/README.md)
- [Publishing](publishing.md)
+37
View File
@@ -0,0 +1,37 @@
# Publishing
## NPM
NPM packages are published through CI/CD in the
[.github/workflows/master.yml](../.github/workflows/master.yml) workflow. Every
commit that is merged to master will be checked for new versions of all public
packages, and any new versions will automatically be published to NPM.
### Creating a new release
Version bumps are made through release PRs. To create a new release, checkout out
a new branch that you will use for the release, e.g.
```sh
$ git checkout -b new-release
```
Then, from the root of the repo, run
```sh
$ yarn release
```
This will bring up the lerna release CLI where you choose what type of version bump
you want to make, (major/minor/patch/prerelease). The CLI will take you through choosing
a version, previewing all changes, and then approving the release. Once the release
is approved, a new commit is created that you can submit as a PR. Push the branch to GitHub:
```sh
$ git push origin -u new-release
```
And then create a PR. Once the PR is approved and merged into master, the master build
will publish new versions of all bumped packages.
[Back to Docs](README.md)
+1
View File
@@ -9,6 +9,7 @@
"build": "lerna run build",
"test": "cross-env CI=true lerna run test --since origin/master -- --coverage",
"create-plugin": "backstage-cli create-plugin",
"release": "if [ \"$(git symbolic-ref --short HEAD)\" = master ]; then echo \"don't try to release master\"; exit 1; else lerna version --no-push; fi",
"lint": "lerna run lint",
"storybook": "yarn workspace storybook start"
},
+3
View File
@@ -24,6 +24,9 @@
"test": "backstage-cli test",
"start": "nodemon ."
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@types/fs-extra": "^8.1.0",
"@types/html-webpack-plugin": "^3.2.2",
@@ -4,7 +4,7 @@
"main": "dist/cjs/index.js",
"types": "dist/cjs/index.d.ts",
"license": "Apache-2.0",
"private": false,
"private": true,
"scripts": {
"build": "backstage-cli plugin:build",
"lint": "backstage-cli lint",
+3
View File
@@ -23,6 +23,9 @@
"lint": "backstage-cli lint",
"test": "backstage-cli test"
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"@material-ui/core": "^4.9.1",
"@material-ui/icons": "^4.9.1",
+1
View File
@@ -3,6 +3,7 @@
"version": "0.1.0",
"main": "dist/cjs/index.js",
"types": "dist/cjs/index.d.ts",
"private": true,
"devDependencies": {
"@spotify-backstage/cli": "^0.1.0",
"@spotify-backstage/core": "^0.1.0",
+1 -1
View File
@@ -4,7 +4,7 @@
"main": "dist/cjs/index.js",
"types": "dist/cjs/index.d.ts",
"license": "Apache-2.0",
"private": false,
"private": true,
"scripts": {
"build": "backstage-cli plugin:build",
"lint": "backstage-cli lint",