Skip to content

Commit 0ec4385

Browse files
Add github action for automation (#696)
* add github action for automation * fix relese commit
1 parent bb6762a commit 0ec4385

File tree

4 files changed

+927
-16
lines changed

4 files changed

+927
-16
lines changed

.github/workflows/release.yaml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# This is a basic workflow that is manually triggered
2+
3+
name: Release the Kraken! 🐙
4+
5+
# Controls when the action will run. Workflow runs when manually triggered using the UI
6+
# or API.
7+
on:
8+
workflow_dispatch:
9+
# Inputs the workflow accepts.
10+
inputs:
11+
release_type:
12+
# Release type
13+
description: 'Release type, major | minor | patch'
14+
default: 'minor'
15+
16+
required: true
17+
18+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
19+
jobs:
20+
# This workflow contains a single job called "greet"
21+
release:
22+
runs-on: ubuntu-latest
23+
# The type of runner that the job will run on
24+
25+
# Steps represent a sequence of tasks that will be executed as part of the job
26+
steps:
27+
# Runs a single command using the runners shell
28+
- name: Checkout
29+
uses: actions/checkout@v2
30+
- name: 'Determine Release Type'
31+
run: |
32+
if ${{ contains(github.event.inputs.release_type, 'major') }}; then
33+
echo "RELEASE_TYPE=major" >> $GITHUB_ENV
34+
elif ${{ contains(github.event.inputs.release_type, 'minor') }}; then
35+
echo "RELEASE_TYPE=minor" >> $GITHUB_ENV
36+
elif ${{ contains(github.event.inputs.release_type, 'patch') }}; then
37+
echo "RELEASE_TYPE=patch" >> $GITHUB_ENV
38+
else
39+
echo "NOTE: There was no release type specified in the commit message, and therefore no release will be published."
40+
exit 1
41+
fi
42+
- name: 'Release Type'
43+
run: echo ${{ env.RELEASE_TYPE }}
44+
- name: git config
45+
run: |
46+
git config user.name ${{ github.actor }}
47+
# See: https://github.com/actions/cache/blob/main/examples.md#node---yarn
48+
- name: Get Yarn cache directory
49+
id: yarn-cache-dir-path
50+
run: echo "::set-output name=dir::$(yarn cache dir)"
51+
52+
- name: Use Yarn cache
53+
uses: actions/cache@v2
54+
id: yarn-cache
55+
with:
56+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
57+
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
58+
59+
- name: Install dependencies
60+
run: yarn install --prefer-offline --frozen-lockfile
61+
62+
- name: release version
63+
run: npm run release -- ${{ env.RELEASE_TYPE }} --ci
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
- name: Merge dev -> main
67+
uses: devmasx/merge-branch@master
68+
with:
69+
type: now
70+
from_branch: dev
71+
target_branch: main
72+
github_token: ${{ github.token }}

.release-it.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"git": {
3+
"commitMessage": "Release v${version}",
4+
"requireCleanWorkingDir": false,
5+
"changelog": "git log --pretty=format:\"* %s (%h)\" ${from}...${to}"
6+
},
7+
"npm": {
8+
"publish": false
9+
},
10+
"github": {
11+
"release": true
12+
}
13+
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
"react-select": "^3.1.0",
114114
"react-spring": "^8.0.27",
115115
"react-text-mask": "^5.4.1",
116+
"release-it": "^14.12.1",
116117
"request": "^2.88.2",
117118
"rxjs": "^6.2.0",
118119
"rxjs-take-while-inclusive": "^2.1.0",

0 commit comments

Comments
 (0)