Skip to content

Commit f495c34

Browse files
authored
Merge pull request #10 from jamdotdev/rui/chore/release-workflow
chore: re-organizes workflows
2 parents c7d2053 + 652a0ad commit f495c34

File tree

2 files changed

+69
-47
lines changed

2 files changed

+69
-47
lines changed

.github/workflows/publish-package.yml

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,79 @@ on:
44
pull_request:
55
types: [closed]
66
branches:
7-
# runs on main PRs targeting main
87
- main
98

109
permissions:
1110
contents: write
1211

1312
jobs:
13+
build-and-lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
21+
- name: setup Node
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: "18.15"
25+
cache: "yarn"
26+
27+
- name: Install
28+
run: yarn install --frozen-lockfile --non-interactive
29+
30+
- name: Build
31+
run: yarn build
32+
33+
- name: Lint
34+
run: yarn lint
35+
36+
deploy-github-pages:
37+
runs-on: ubuntu-latest
38+
needs: build-and-lint
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v3
42+
with:
43+
fetch-depth: 0
44+
45+
- name: setup Node
46+
uses: actions/setup-node@v3
47+
with:
48+
node-version: "18.15"
49+
cache: "yarn"
50+
51+
# Build base package, so links work
52+
- name: Install
53+
run: yarn install --frozen-lockfile --non-interactive
54+
55+
- name: Build
56+
run: yarn build
57+
58+
# For the mobx example
59+
- name: Install
60+
run: yarn install --frozen-lockfile --non-interactive
61+
working-directory: ./docs/todo-mobx-example
62+
63+
- name: Build
64+
run: yarn build
65+
working-directory: ./docs/todo-mobx-example
66+
67+
- name: Copy output
68+
run: mv docs/todo-mobx-example/dist docs/public && mv docs/public/dist docs/public/todo-mobx-example
69+
# End mobx example
70+
71+
- name: Deploy
72+
uses: peaceiris/actions-gh-pages@v3
73+
with:
74+
github_token: ${{ secrets.GITHUB_TOKEN }}
75+
publish_dir: ./docs/public
76+
1477
publish:
1578
if: github.event.pull_request.merged == true && (contains(github.event.pull_request.labels.*.name, 'release-major') || contains(github.event.pull_request.labels.*.name, 'release-minor') || contains(github.event.pull_request.labels.*.name, 'release-patch'))
79+
needs: build-and-lint
1680
runs-on: ubuntu-latest
1781
steps:
1882
- name: Determine version type from label
@@ -48,7 +112,7 @@ jobs:
48112

49113
- name: Configure git author
50114
run: |
51-
git config user.name github-actions
115+
git config user.name GitHub Actions
52116
git config user.email github-actions@github.com
53117
54118
- name: Setup Node
Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
name: Test and Release
1+
name: Validate PR changes
22

33
on:
4-
push:
5-
branches:
6-
- main
4+
pull_request:
5+
types: [opened, reopened, synchronize, labeled]
76

87
jobs:
98
build-and-lint:
@@ -28,44 +27,3 @@ jobs:
2827

2928
- name: Lint
3029
run: yarn lint
31-
32-
deploy-github-pages:
33-
runs-on: ubuntu-latest
34-
needs: build-and-lint
35-
steps:
36-
- name: Checkout
37-
uses: actions/checkout@v3
38-
with:
39-
fetch-depth: 0
40-
41-
- name: setup Node
42-
uses: actions/setup-node@v3
43-
with:
44-
node-version: "18.15"
45-
cache: "yarn"
46-
47-
# Build base package, so links work
48-
- name: Install
49-
run: yarn install --frozen-lockfile --non-interactive
50-
51-
- name: Build
52-
run: yarn build
53-
54-
# For the mobx example
55-
- name: Install
56-
run: yarn install --frozen-lockfile --non-interactive
57-
working-directory: ./docs/todo-mobx-example
58-
59-
- name: Build
60-
run: yarn build
61-
working-directory: ./docs/todo-mobx-example
62-
63-
- name: Copy output
64-
run: mv docs/todo-mobx-example/dist docs/public && mv docs/public/dist docs/public/todo-mobx-example
65-
# End mobx example
66-
67-
- name: Deploy
68-
uses: peaceiris/actions-gh-pages@v3
69-
with:
70-
github_token: ${{ secrets.GITHUB_TOKEN }}
71-
publish_dir: ./docs/public

0 commit comments

Comments
 (0)