Skip to content

Commit b00d4a6

Browse files
committed
better artifact naming, auto publishing to release
1 parent bbd1015 commit b00d4a6

1 file changed

Lines changed: 43 additions & 3 deletions

File tree

.github/workflows/binaries.yml

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ jobs:
5757
steps:
5858
- uses: actions/checkout@master
5959

60+
- name: Set version suffix
61+
run: |
62+
if [[ "${{ github.ref_type }}" == "tag" ]]; then
63+
echo "VERSION_SUFFIX=${{ github.ref_name }}" >> $GITHUB_ENV
64+
else
65+
echo "VERSION_SUFFIX=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
66+
fi
67+
6068
- name: Download headers
6169
uses: actions/download-artifact@v4
6270
with:
@@ -122,9 +130,21 @@ jobs:
122130
- name: Upload artifact
123131
uses: actions/upload-artifact@v6
124132
with:
125-
name: moon-linux-lua${{ matrix.lua_version }}
133+
name: moonscript-${{ env.VERSION_SUFFIX }}-linux-lua${{ matrix.lua_version }}
126134
path: dist/
127135

136+
- name: Package for release
137+
if: github.ref_type == 'tag'
138+
run: |
139+
cd dist
140+
tar -czvf ../moonscript-${{ env.VERSION_SUFFIX }}-linux-x86_64.tar.gz *
141+
142+
- name: Upload to release
143+
if: github.ref_type == 'tag'
144+
uses: softprops/action-gh-release@v2
145+
with:
146+
files: moonscript-${{ env.VERSION_SUFFIX }}-linux-x86_64.tar.gz
147+
128148
windows:
129149
runs-on: windows-latest
130150
needs: generate-headers
@@ -140,6 +160,14 @@ jobs:
140160
steps:
141161
- uses: actions/checkout@master
142162

163+
- name: Set version suffix
164+
run: |
165+
if [[ "${{ github.ref_type }}" == "tag" ]]; then
166+
echo "VERSION_SUFFIX=${{ github.ref_name }}" >> $GITHUB_ENV
167+
else
168+
echo "VERSION_SUFFIX=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
169+
fi
170+
143171
- name: Download headers
144172
uses: actions/download-artifact@v4
145173
with:
@@ -148,7 +176,7 @@ jobs:
148176

149177
- uses: msys2/setup-msys2@v2
150178
with:
151-
install: gcc make curl
179+
install: gcc make curl zip
152180

153181
- name: Show GCC
154182
run: gcc -v
@@ -209,5 +237,17 @@ jobs:
209237
- name: Upload artifact
210238
uses: actions/upload-artifact@v6
211239
with:
212-
name: moon-windows-lua${{ matrix.lua_version }}
240+
name: moonscript-${{ env.VERSION_SUFFIX }}-windows-lua${{ matrix.lua_version }}
213241
path: dist/
242+
243+
- name: Package for release
244+
if: github.ref_type == 'tag'
245+
run: |
246+
cd dist
247+
zip ../moonscript-${{ env.VERSION_SUFFIX }}-windows-x86_64.zip *
248+
249+
- name: Upload to release
250+
if: github.ref_type == 'tag'
251+
uses: softprops/action-gh-release@v2
252+
with:
253+
files: moonscript-${{ env.VERSION_SUFFIX }}-windows-x86_64.zip

0 commit comments

Comments
 (0)