-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (115 loc) · 3.82 KB
/
release_main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Release Main
on:
push:
branches:
- main
jobs:
correct_repository:
runs-on: ubuntu-latest
steps:
- name: fail on fork
if: github.repository_owner != 'lineupjs'
run: exit 1
create_release:
needs: correct_repository
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Extract version
id: extract_version
run: |
node -pe "'::set-output name=version::' + require('./package.json').version"
node -pe "'::set-output name=npm_tag::' + (require('./package.json').version.includes('-') ? 'next' : 'latest')"
- name: Print version
run: |
echo "releasing ${{ steps.extract_version.outputs.version }} with tag ${{ steps.extract_version.outputs.npm_tag }}"
- name: Create Release
id: create_release
uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.PRIVATE_GITHUB_TOKEN }}
with:
name: v${{ steps.extract_version.outputs.version }}
tag: v${{ steps.extract_version.outputs.version }}
version: ${{ steps.extract_version.outputs.version }}
prerelease: ${{ needs.create_release.outputs.tag_name == 'next' }}
publish: true
outputs:
version: ${{ steps.extract_version.outputs.version }}
npm_tag: ${{ steps.extract_version.outputs.npm_tag }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
tag_name: ${{ steps.create_release.outputs.tag_name }}
npm_publish:
needs: create_release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm i -g yarn
- run: yarn config set checksumBehavior ignore
- name: Cache Node.js modules
uses: actions/cache@v4
with:
path: |
./.yarn/cache
./.yarn/unplugged
key: ${{ runner.os }}-yarn2-v4-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn2-v4
- run: yarn install
- run: yarn clean
- run: yarn compile
- run: yarn build
- run: yarn lint
- run: yarn test:coverage
- run: yarn docs
- run: |
mkdir -p public/main/docs
cp -r build/* public/main
cp -r docs/* public/main/docs
mv README.md public/
mkdir -p public_dev/develop/docs
cp -r build/* public_dev/develop
cp -r docs/* public_dev/develop/docs
- name: Deploy Main
uses: upsetjs/actions-gh-pages@sgratzl
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
with:
personal_token: ${{ secrets.PRIVATE_GITHUB_TOKEN }}
external_repository: lineupjs/lineupengine.js.org
publish_branch: main
publish_dir: ./public
enable_jekyll: true
remove_path_spec: 'README.md,main'
- name: Pack Publish
run: |
yarn config set npmAuthToken "${{ secrets.NPM_TOKEN }}"
yarn pack
yarn npm publish --tag "${{ needs.create_release.outputs.npm_tag }}"
# - name: Upload Release Asset
# uses: AButler/upload-release-assets@v2.0
# with:
# files: '*.tgz'
# repo-token: ${{ secrets.PRIVATE_GITHUB_TOKEN }}
# release-tag: ${{ needs.create_release.outputs.tag_name }}
sync_dev:
needs: correct_repository
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: develop
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Reset dev branch
run: |
git fetch origin main:main
git merge main
git push