diff --git a/.github/workflows/release_on_tag.yml b/.github/workflows/release_on_tag.yml new file mode 100644 index 0000000..5eafb3d --- /dev/null +++ b/.github/workflows/release_on_tag.yml @@ -0,0 +1,25 @@ +on: + push: + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +name: Upload Release Asset + +jobs: + build: + name: Upload Release Asset + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Build project + run: | + yarn + yarn build + - name: Release ${{ github.ref }} + uses: softprops/action-gh-release@v1 + with: + files: | + built/*linux.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.sh b/build.sh index 8a35c1e..ae1a8b6 100755 --- a/build.sh +++ b/build.sh @@ -6,7 +6,11 @@ if [ -d "built" ] ; then fi PACKAGE_VERSION=$( awk -F'"' '/"version": ".+"/{ print $4; exit; }' package.json) -echo "Building anyCiCd-$PACKAGE_VERSION" + function getHash(){ + git rev-parse --short HEAD + } + +echo "Building anyCiCd-$PACKAGE_VERSION #$(getHash)" function pack(){ if [ ! -d "built" ] ; then @@ -26,11 +30,11 @@ function pack(){ } function generic(){ - npx pkg --config dist/package.json -o "./built/anyCiCd-generic-$PACKAGE_VERSION" ./dist/bin/www.js + npx pkg --config dist/package.json -o "./built/anyCiCd-$PACKAGE_VERSION-$(getHash)-generic" ./dist/bin/www.js pack } function rpi(){ - npx pkg --config rpi_build_conf.json -o "./built/anyCiCd-rpi-$PACKAGE_VERSION" ./dist/bin/www.js + npx pkg --config rpi_build_conf.json -o "./built/anyCiCd-$PACKAGE_VERSION-$(getHash)-rpi" ./dist/bin/www.js pack }