@@ -21,50 +21,76 @@ jobs:
2121 with :
2222 submodules : recursive
2323
24+ - name : Setting up workflow variables
25+ id : vars
26+ shell : bash
27+ run : |
28+ # Package version
29+ if [[ $GITHUB_REF = refs/tags/* ]]; then
30+ PKG_VERSION=${GITHUB_REF##*/}
31+ else
32+ PKG_VERSION=${GITHUB_SHA:0:8}
33+ fi
34+
35+ # Package suffic relative to the platform
36+ if [[ "${{ matrix.job.target }}" = windows ]]; then
37+ PKG_SUFFIX="zip"
38+ else
39+ PKG_SUFFIX="tar.gz"
40+ fi
41+
42+ # Package name w/ version
43+ PKG_BASENAME="${{ env.PROJECT }}-${PKG_VERSION}-${{ matrix.job.target }}"
44+
45+ # Full name of the tarball asset
46+ PKG_NAME="${PKG_BASENAME}.${PKG_SUFFIX}"
47+
48+ # Staging area for tarballs
49+ PKG_STAGING="ci_staging/$PKG_BASENAME"
50+
51+ echo ::set-output name=PKG_VERSION::${PKG_VERSION}
52+ echo ::set-output name=PKG_BASENAME::${PKG_BASENAME}
53+ echo ::set-output name=PKG_NAME::${PKG_NAME}
54+ echo ::set-output name=PKG_PATH::"${PKG_STAGING}/${PKG_NAME}"
55+ echo ::set-output name=PKG_STAGING::${PKG_STAGING}
56+
2457 - uses : actboy168/setup-luamake@master
2558
2659 - run : luamake
2760
2861 - uses : actions/upload-artifact@v2
2962 with :
30- name : ${{ env.PROJECT }}-${{ matrix.job.target }}
63+ name : ${{ steps.vars.outputs.PKG_BASENAME }}
3164 path : ${{ env.BIN }}
3265
33- - name : Package
66+ - name : Package tarballs
3467 if : startsWith(github.ref, 'refs/tags/')
35- id : package
3668 shell : bash
3769 run : |
38- # Some variables
39- PKG_BASENAME="${{ env.PROJECT }}-${{ matrix.job.target }}"
40- PKG_STAGING="ci_staging/${PKG_BASENAME}"
70+ STAGING=${{ steps.vars.outputs.PKG_STAGING }}
71+ NAME=${{ steps.vars.outputs.PKG_NAME }}
4172
4273 # Making the staging area
43- mkdir -p ${PKG_STAGING }
74+ mkdir -p ${STAGING }
4475
4576 # Copying binary and runtime files to staging area
46- cp -r main.lua debugger.lua locale meta script ${{ env.BIN }} ${PKG_STAGING }
77+ cp -r main.lua debugger.lua locale meta script ${{ env.BIN }} ${STAGING }
4778
4879 # Creating release assets
49- pushd "${PKG_STAGING }/" >/dev/null
80+ pushd "${STAGING }/" >/dev/null
5081 case "${{ matrix.job.target }}" in
5182 windows)
52- PKG_NAME="${PKG_BASENAME}.zip"
53- 7z -y a ${PKG_NAME} * | tail -2
83+ 7z -y a ${NAME} * | tail -2
5484 ;;
5585 *)
56- PKG_NAME="${PKG_BASENAME}.tar.gz"
57- tar czf ${PKG_NAME} *
86+ tar czf ${NAME} *
5887 ;;
5988 esac;
6089 popd >/dev/null
6190
62- echo ::set-output name=PKG_NAME::${PKG_NAME}
63- echo ::set-output name=PKG_PATH::"${PKG_STAGING}/${PKG_NAME}"
64-
6591 - name : Publish release assets
6692 uses : softprops/action-gh-release@v1
6793 if : startsWith(github.ref, 'refs/tags/')
6894 with :
6995 generate_release_notes : true
70- files : ${{ steps.package .outputs.PKG_PATH }}
96+ files : ${{ steps.vars .outputs.PKG_PATH }}
0 commit comments