Skip to content

Commit 29e1635

Browse files
Merge pull request #81 from grammarly/f-better-release
Improve release
2 parents a224157 + 9df5ad2 commit 29e1635

File tree

8 files changed

+35
-34
lines changed

8 files changed

+35
-34
lines changed

.github/workflows/Readme.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
## Release
44

5-
For each tag `v*` that is pushed into `master` branch CI creates ["Release"](https://github.com/grammarly/focal/releases) and attaches package tarball `grammarly-focal-v*.tgz`. For details see `release.yml`
5+
1. Create pull-request for relese "Release vX.X.X"
6+
2. Run in root `yarn bump-release X.X.X`
7+
3. yarn bump-release will bump focal version, update deps in private packages and create a commit
8+
4. Merge and manually create [GitHub Release](https://github.com/grammarly/focal/releases)
9+
5. On release "publish" GitHub Actions will trigger build and attach tarball to "Release". For details see `release.yml`
610

711
## Tests
812

.github/workflows/release.yml

+9-25
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,29 @@
11
name: Release
22

33
on:
4-
push:
5-
tags:
6-
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
4+
release:
5+
types: [published]
76

87
jobs:
98
release:
10-
# There is no way to run a workflow on push tags on a specific branch.
11-
# The job should be skipped when running for a non-master branch.
12-
if: github.ref == 'refs/heads/master'
13-
name: Release (skip on non-main branch)
9+
name: Release
1410
runs-on: ubuntu-latest
1511
steps:
1612
- name: Branch name
1713
id: branch_name
1814
run: |
15+
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
1916
echo ::set-output name=TARBALL::grammarly-focal-${GITHUB_REF#refs/tags/}.tgz
2017
- name: Checkout code
2118
uses: actions/checkout@v2
2219
- run: yarn install
2320
- run: yarn build
2421
- run: yarn test
2522
- run: yarn package
26-
- name: Create Release
27-
id: create_release
28-
uses: actions/create-release@v1
29-
env:
30-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31-
with:
32-
tag_name: ${{ github.ref }}
33-
release_name: ${{ github.ref }}
34-
draft: false
35-
prerelease: false
36-
- name: Upload Release Asset
37-
id: upload-release-asset
38-
uses: actions/upload-release-asset@v1
39-
env:
40-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
- name: Upload binaries to release
24+
uses: svenstaro/upload-release-action@v2
4125
with:
42-
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
43-
asset_path: ./packages/focal/${{ steps.branch_name.outputs.TARBALL }}
26+
repo_token: ${{ secrets.GITHUB_TOKEN }}
27+
file: ./packages/focal/${{ steps.branch_name.outputs.TARBALL }}
4428
asset_name: ${{ steps.branch_name.outputs.TARBALL }}
45-
asset_content_type: application/zip
29+
tag: ${{ github.ref }}

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"build": "yarn workspace @grammarly/focal build",
66
"package": "yarn workspace @grammarly/focal pack",
77
"test": "yarn workspace @grammarly/focal test && yarn workspace focal-todomvc build && yarn workspace focal-examples build && yarn workspace focal-manual-tests build",
8-
"postinstall": "yarn build"
8+
"postinstall": "yarn build",
9+
"bump-version": "sh ./scripts/release.sh"
910
},
1011
"devDependencies": {
1112
"@grammarly/tslint-config": "0.5.1",

packages/examples/all/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"author": "Grammarly, Inc.",
2121
"license": "Apache-2.0",
2222
"devDependencies": {
23-
"@grammarly/focal": "0.8.4",
23+
"@grammarly/focal": "0.8.5",
2424
"@grammarly/tslint-config": "0.5.1",
2525
"@types/react": "16.9.11",
2626
"@types/react-dom": "16.9.3",

packages/examples/todomvc/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"author": "Grammarly, Inc.",
2121
"license": "Apache-2.0",
2222
"devDependencies": {
23-
"@grammarly/focal": "0.8.4",
23+
"@grammarly/focal": "0.8.5",
2424
"@grammarly/tslint-config": "0.5.1",
2525
"@types/react": "16.9.11",
2626
"@types/react-dom": "16.9.3",

packages/focal/package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@grammarly/focal",
3-
"version": "0.8.4",
3+
"version": "0.8.5",
44
"description": "FRP UI with React, observables, immutable data and lenses",
55
"main": "dist/_cjs/src/index.js",
66
"module": "dist/_esm5/src/index.js",
@@ -28,10 +28,9 @@
2828
"build": "npm run clean && yarn build:cjs && yarn build:es5 && yarn build:es2015 && npm run lint",
2929
"test": "jest",
3030
"test:watch": "jest --watch",
31-
"lint": "eslint './src/**/*.ts*' './test/**/*.ts*' && tsc --noemit",
31+
"lint": "tslint --type-check --project tsconfig.json -c tslint.json",
3232
"prepack": "cp ../../README.md ./ && cp ../../LICENSE ./",
33-
"postpack": "rm README.md && rm LICENSE",
34-
"preversion": "if ! [[ $(git rev-parse --abbrev-ref HEAD) == \"master\" ]]; then echo \"Not on the master branch.\" && exit 1; fi"
33+
"postpack": "rm README.md && rm LICENSE"
3534
},
3635
"author": "Sergey Yavnyi <[email protected]>",
3736
"contributors": [

packages/test/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"author": "Grammarly, Inc.",
1717
"license": "Apache-2.0",
1818
"devDependencies": {
19-
"@grammarly/focal": "0.8.4",
19+
"@grammarly/focal": "0.8.5",
2020
"@grammarly/tslint-config": "0.5.1",
2121
"@types/node": "^9.6.0",
2222
"@types/react": "16.9.11",

scripts/release.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
VER=$1
4+
5+
echo "Releasing version $1"
6+
7+
cd packages/focal && yarn version --new-version $VER --no-git-tag-version && cd ../..
8+
sed -i '' 's/grammarly\/focal":.*$/grammarly\/focal": "'${VER}'",/g' packages/examples/all/package.json
9+
sed -i '' 's/grammarly\/focal":.*$/grammarly\/focal": "'${VER}'",/g' packages/examples/todomvc/package.json
10+
sed -i '' 's/grammarly\/focal":.*$/grammarly\/focal": "'${VER}'",/g' packages/test/package.json
11+
# yarn
12+
git add .
13+
git commit -m "v$VER"

0 commit comments

Comments
 (0)