11name : Build
22on : push
3+ permissions : write-all
34
45jobs :
5- check :
6+ build :
67 runs-on : ubuntu-latest
7- outputs :
8- name : ${{ steps.getname.outputs.NAME }}
9- icon : ${{ steps.getname.outputs.ICON }}
108 steps :
119 - name : Checkout
12- uses : actions/checkout@v3
10+ uses : actions/checkout@v4
1311 with :
1412 fetch-depth : 1
15- - name : Install Rust Stable
16- uses : dtolnay/rust-toolchain@stable
17- - name : check
18- run : cargo check --all --all-targets
1913 - name : Install zip
20- run : sudo apt-get install -y zip jq
14+ run : sudo apt-get install -y jq
2115 - id : getname
2216 run : |
23- echo "NAME=$(cat info.json | jq '.id' | tr -d '"')" >> "$GITHUB_OUTPUT"
24- echo "ICON=$(cat info.json | jq '.icon' | tr -d '"')" >> "$GITHUB_OUTPUT"
25- build-for-windows :
26- needs : check
27- strategy :
28- fail-fast : false
29- matrix :
30- platform : [windows-latest]
31- target :
32- [
33- x86_64-pc-windows-msvc,
34- i686-pc-windows-msvc,
35- aarch64-pc-windows-msvc,
36- ]
37- runs-on : ${{ matrix.platform }}
38- steps :
39- - name : Checkout
40- uses : actions/checkout@v3
41- with :
42- fetch-depth : 1
43- - name : Install Rust Stable
44- uses : dtolnay/rust-toolchain@stable
45- - name : install toolchain
46- run : |
47- rustup target add ${{ matrix.target }}
48- rustup toolchain install --force-non-host stable-${{ matrix.target }}
49- - name : Build
50- run : cargo build --release --target ${{ matrix.target }}
51- - name : Rename
52- run : move target/${{ matrix.target }}/release/plugin.dll ./plugin.dll
17+ echo "NAME=$(cat info.json | jq '.id' | tr -d '"')" >> "$GITHUB_ENV"
18+ echo "ICON=$(cat info.json | jq '.icon' | tr -d '"')" >> "$GITHUB_ENV"
5319 - uses : vimtor/action-zip@v1
5420 with :
55- files : info.json ${{needs.check.outputs.icon }} plugin.dll
56- dest : ${{needs.check.outputs.name }}.potext
21+ files : info.json ${{ env.ICON }} main.js
22+ dest : ${{ env.NAME }}.potext
5723 - name : Upload Artifacts
58- uses : actions/upload-artifact@v3
24+ uses : actions/upload-artifact@v4
5925 with :
60- name : ${{ matrix.target }}
26+ name : ${{ env.NAME }}.potext
6127 path : " *.potext"
6228 if-no-files-found : error
63- - name : Wrap
64- if : startsWith(github.ref, 'refs/tags')
65- uses : vimtor/action-zip@v1
66- with :
67- files : ${{needs.check.outputs.name}}.potext
68- dest : ${{ matrix.target }}.zip
69- - name : Upload Release
70- if : startsWith(github.ref, 'refs/tags')
71- uses : softprops/action-gh-release@v1
72- with :
73- token : ${{ secrets.TOKEN }}
74- files : ${{ matrix.target }}.zip
75- build-for-macos :
76- needs : check
77- strategy :
78- fail-fast : false
79- matrix :
80- platform : [macos-latest]
81- target : [x86_64-apple-darwin, aarch64-apple-darwin]
82- runs-on : ${{ matrix.platform }}
83- steps :
84- - name : Checkout
85- uses : actions/checkout@v3
86- with :
87- fetch-depth : 1
88- - name : Install Rust Stable
89- uses : dtolnay/rust-toolchain@stable
90- - name : install toolchain
91- run : |
92- rustup target add ${{ matrix.target }}
93- rustup toolchain install --force-non-host stable-${{ matrix.target }}
94- - name : Build
95- run : cargo build --release --target ${{ matrix.target }}
96- - name : Rename
97- run : sudo mv target/${{ matrix.target }}/release/libplugin.dylib ./plugin.dylib
98- - uses : vimtor/action-zip@v1
99- with :
100- files : info.json ${{needs.check.outputs.icon}} plugin.dylib
101- dest : ${{needs.check.outputs.name}}.potext
102- - name : Upload Artifacts
103- uses : actions/upload-artifact@v3
104- with :
105- name : ${{ matrix.target }}
106- path : " *.potext"
107- if-no-files-found : error
108- - name : Wrap
109- if : startsWith(github.ref, 'refs/tags')
110- uses : vimtor/action-zip@v1
111- with :
112- files : ${{needs.check.outputs.name}}.potext
113- dest : ${{ matrix.target }}.zip
114- - name : Upload Release
115- if : startsWith(github.ref, 'refs/tags')
116- uses : softprops/action-gh-release@v1
117- with :
118- token : ${{ secrets.TOKEN }}
119- files : ${{ matrix.target }}.zip
120- build-for-linux :
121- needs : check
122- strategy :
123- fail-fast : false
124- matrix :
125- platform : [ubuntu-latest]
126- target :
127- [
128- x86_64-unknown-linux-gnu,
129- i686-unknown-linux-gnu,
130- aarch64-unknown-linux-gnu,
131- armv7-unknown-linux-gnueabihf,
132- ]
133- runs-on : ${{ matrix.platform }}
134- steps :
135- - name : Checkout
136- uses : actions/checkout@v3
137- with :
138- fetch-depth : 1
139- - name : Build for Linux
140- uses : ./.github/build-for-linux
141- with :
142- target : ${{ matrix.target }}
143- toolchain : stable-${{ matrix.target }}
144- - uses : vimtor/action-zip@v1
145- with :
146- files : info.json ${{needs.check.outputs.icon}} plugin.so
147- dest : ${{needs.check.outputs.name}}.potext
148- - name : Upload Artifacts
149- uses : actions/upload-artifact@v3
150- with :
151- name : ${{ matrix.target }}
152- path : " *.potext"
153- if-no-files-found : error
154- - name : Wrap
155- if : startsWith(github.ref, 'refs/tags')
156- uses : vimtor/action-zip@v1
157- with :
158- files : ${{needs.check.outputs.name}}.potext
159- dest : ${{ matrix.target }}.zip
16029 - name : Upload Release
16130 if : startsWith(github.ref, 'refs/tags')
162- uses : softprops/action-gh-release@v1
31+ uses : softprops/action-gh-release@v2
16332 with :
164- token : ${{ secrets.TOKEN }}
165- files : ${{ matrix.target }}.zip
33+ token : ${{ secrets.GITHUB_TOKEN }}
34+ files : " *.potext "
0 commit comments