Skip to content

Commit

Permalink
change build script to include hash of the head commit builded
Browse files Browse the repository at this point in the history
- added an action to trigger releases on new tags
  • Loading branch information
Kos-M committed Mar 7, 2024
1 parent 2b1201e commit 12e4ec9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/release_on_tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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 build
- name: Release ${{ github.ref }}
uses: softprops/action-gh-release@v1
with:
files: |
built/*linux.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 7 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand Down

0 comments on commit 12e4ec9

Please sign in to comment.