Skip to content

Commit da03220

Browse files
authored
chore: automatic release (#305)
Configure automatic release by release-please to prevent v1.0.0 release
1 parent df0a78a commit da03220

File tree

4 files changed

+88
-61
lines changed

4 files changed

+88
-61
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ name: 'build-test'
22
on:
33
pull_request:
44
push:
5+
branches-ignore:
6+
- master
7+
workflow_call:
58

69
jobs:
710
build:
8-
strategy:
9-
matrix:
10-
os: [ubuntu, macos, windows]
11-
runs-on: ${{ matrix.os }}-latest
11+
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
1414
- name: Get yarn cache directory path
@@ -24,9 +24,24 @@ jobs:
2424
- run: yarn install --frozen-lockfile
2525
- run: yarn build
2626
- run: yarn package
27+
- uses: actions/upload-artifact@v3
28+
with:
29+
name: dist
30+
path: ./dist/
31+
32+
test:
33+
needs: [build]
34+
strategy:
35+
matrix:
36+
os: [ubuntu, macos, windows]
37+
runs-on: ${{ matrix.os }}-latest
38+
steps:
39+
- uses: actions/download-artifact@v3
40+
with:
41+
name: dist
2742

2843
- name: Install with no params
29-
uses: ./dist/
44+
uses: ./
3045
- if: runner.os == 'Linux'
3146
run: chrome --version
3247
- if: runner.os == 'macOS'
@@ -36,7 +51,7 @@ jobs:
3651
# Unable to run with command-line option on windows
3752

3853
- name: Install with version '827102'
39-
uses: ./dist/
54+
uses: ./
4055
with:
4156
chrome-version: 827102
4257
- if: runner.os == 'Linux'
@@ -48,7 +63,7 @@ jobs:
4863
# Unable to run with command-line option on windows
4964

5065
- name: install with version 'dev'
51-
uses: ./dist/
66+
uses: ./
5267
with:
5368
chrome-version: dev
5469
- if: runner.os == 'Linux'
@@ -58,57 +73,3 @@ jobs:
5873
- if: runner.os == 'Windows'
5974
run: (Get-Item (Get-Command chrome).Source).VersionInfo.ProductVersion
6075
# Unable to run with command-line option on windows
61-
62-
63-
deploy:
64-
runs-on: ubuntu-latest
65-
needs: [build]
66-
if: github.ref == 'refs/heads/master'
67-
steps:
68-
- uses: actions/checkout@v3
69-
- name: Get yarn cache directory path
70-
id: yarn-cache-dir-path
71-
run: echo "::set-output name=dir::$(yarn cache dir)"
72-
- uses: actions/cache@v3
73-
with:
74-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
75-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
76-
restore-keys: |
77-
${{ runner.os }}-yarn-
78-
- uses: actions/checkout@v3
79-
with:
80-
ref: 'latest'
81-
path: 'dist'
82-
83-
- run: yarn install --frozen-lockfile
84-
- run: yarn build
85-
- run: yarn package
86-
- name: Setup git
87-
run: |
88-
git config --global user.name "Shin'ya Ueoka"
89-
git config --global user.email "[email protected]"
90-
91-
cat >$HOME/.netrc <<EOF
92-
machine github.com
93-
login ueokande
94-
password ${GITHUB_TOKEN}
95-
EOF
96-
97-
- name: Deploy to latest branch
98-
working-directory: ./dist
99-
env:
100-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101-
run: |
102-
# Abort job successfully when no scripts updated
103-
test -z "$(git status --short)" && exit 0
104-
105-
git add .
106-
git commit --message "Release for ${GITHUB_SHA}"
107-
git push origin latest
108-
109-
test-latest:
110-
runs-on: ubuntu-latest
111-
needs: [deploy]
112-
steps:
113-
- uses: browser-actions/setup-chrome@latest
114-
- run: chrome --version

.github/workflows/release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: 'release'
2+
on:
3+
push:
4+
branches:
5+
- master
6+
7+
jobs:
8+
build:
9+
uses: ./.github/workflows/build.yml
10+
11+
release:
12+
runs-on: ubuntu-latest
13+
needs: [build]
14+
steps:
15+
- uses: google-github-actions/release-please-action@v3
16+
id: release
17+
with:
18+
command: manifest
19+
20+
- uses: actions/checkout@v3
21+
with:
22+
ref: 'latest'
23+
if: ${{ steps.release.outputs.release_created }}
24+
- uses: actions/download-artifact@v3
25+
with:
26+
name: dist
27+
if: ${{ steps.release.outputs.release_created }}
28+
29+
- name: Publish to GitHub
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
major_version: ${{ steps.release.outputs.major }}
33+
full_version: ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}
34+
run: |
35+
git remote set-url origin https://github-actions:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
36+
git config --global user.name "${GITHUB_ACTOR}"
37+
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
38+
39+
git add .
40+
git commit --allow-empty --message "Release v${full_version} at ${GITHUB_SHA}"
41+
42+
git tag -d v$major_version || true
43+
git tag -d v$full_version || true
44+
git tag -a v$major_version -m "Release v$full_version"
45+
git tag -a v$full_version -m "Release v$full_version"
46+
47+
git push origin latest
48+
git push origin v$major_version --force
49+
git push origin v$full_version
50+
51+
if: ${{ steps.release.outputs.release_created }}

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.0.0"
3+
}

release-please-config.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"packages": {
3+
".": {
4+
"changelog-path": "CHANGELOG.md",
5+
"release-type": "node",
6+
"bump-minor-pre-major": false,
7+
"bump-patch-for-minor-pre-major": false,
8+
"draft": true
9+
}
10+
},
11+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
12+
}

0 commit comments

Comments
 (0)