-
-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (74 loc) · 2.38 KB
/
createRelease.yaml
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
name: Create release
on:
push:
branches:
- main
jobs:
create-release:
name: Create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create-release.outputs.upload_url }}
version: ${{ steps.get-version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Read version from package.json
id: get-version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Create Git tag
run: |
git tag v${{ env.version }}
git push origin v${{ env.version }}
- name: Create GitHub release
id: create-release
uses: softprops/action-gh-release@v2
with:
name: "${{ env.version }}"
tag_name: "v${{ env.version }}"
body: "Release for version ${{ env.version }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
upload-assets:
name: Upload asset
needs: create-release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install dependencies
run: npm --color install
- name: Package artifact
run: npm --color run package
- name: Compress artifact (Windows)
run: powershell.exe Compress-Archive -Path 'dist/*' -DestinationPath 'artifact.zip'
if: runner.os == 'Windows'
- name: Compress artifact (Linux)
run: |
cd dist
zip -r ../artifact.zip *
if: runner.os != 'Windows'
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./artifact.zip
asset_name: Clippy-${{ needs.create-release.outputs.version }}-${{ runner.os }}.zip
asset_content_type: application/zip