Skip to content

Instantly share code, notes, and snippets.

@Geertvdc
Last active November 11, 2019 08:33
Show Gist options
  • Save Geertvdc/c903b959a20f47c48fb96cf9601c1d41 to your computer and use it in GitHub Desktop.
Save Geertvdc/c903b959a20f47c48fb96cf9601c1d41 to your computer and use it in GitHub Desktop.
Github Actions Workflow with hub CLI
name: Build
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v1
- name: Install hub cli
uses: geertvdc/setup-hub@master
- name: Build & Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
version=$(hub release -L 1| awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{$NF=sprintf("%0*d", length($NF), ($NF+1)); print}')
echo $version
#build frontend
cd $GITHUB_WORKSPACE/frontend/xpirit-beerxchange
npm install
npm run build-prod
cd dist
zip -r frontend-$version.zip .
cp frontend-$version.zip $HOME/artifacts/
#create release
cd $GITHUB_WORKSPACE
hub release create -m $version -a $HOME/artifacts/frontend-$version.zip $version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment