-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (58 loc) · 2.02 KB
/
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
on:
push:
branches:
- main
- master
- development
env:
REPO_NAME: ${{ github.event.repository.name }}
EXTRA_RELEASE_ARGS: ${{ github.ref == 'refs/heads/development' && '--prerelease' || '' }}
jobs:
build_and_release:
name: Build and Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
- name: Parse package.json
id: set_var
run: |
content=`cat ./package.json`
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
echo "::set-output name=packageJson::$content"
- run: |
echo "${{fromJson(steps.set_var.outputs.packageJson).version}}"
echo "${{fromJson(steps.set_var.outputs.packageJson).devDependencies['@wayward/types']}}"
typesversion=$(echo ${{fromJson(steps.set_var.outputs.packageJson).devDependencies['@wayward/types']}} | cut -c 2-999)
echo "$typesversion"
echo "TYPES_VERSION=$typesversion" >> $GITHUB_ENV
- name: npm install
run: npm install
- name: npm run build
run: npm run build
- name: zip
run: |
cd ../
zip -r $REPO_NAME.zip $REPO_NAME -x "$REPO_NAME/.git/*" "$REPO_NAME/.github/*" "$REPO_NAME/node_modules/*"
- name: Delete release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
run: |
gh release delete "v$TYPES_VERSION" --cleanup-tag --yes
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "v$TYPES_VERSION" \
--repo="$GITHUB_REPOSITORY" \
--target="${{ github.sha }}" \
--title="v$TYPES_VERSION" \
--generate-notes \
$EXTRA_RELEASE_ARGS \
"../$REPO_NAME.zip#$REPO_NAME.zip"