Skip to content

ph-municipalities_v1.2.0 #22

ph-municipalities_v1.2.0

ph-municipalities_v1.2.0 #22

Workflow file for this run

name: Package Windows Binaries
# This workflow will trigger on any tag/release created on *any* branch
# Make sure to create tags/releases only from the "master" branch for consistency
on:
release:
types: [published]
jobs:
build-on-win:
name: Lint and Package App
runs-on: windows-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}
- name: Use NodeJS v16.14.2
uses: actions/setup-node@v3
with:
node-version: 16.14.2
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: npm-${{ hashFiles('app/package-lock.json') }}
restore-keys: npm-
- name: Install Dependencies and lint
run: |
cd app
npm install
git rm .eslintrc.js
# Quick hack to fix unix to windows linebreak-style lint errors
git mv .eslintrc_win.js .eslintrc.js
npm run lint
- name: Packge and archive the executable files
run: |
cd app
cp .env.example .env
npm run build:win:all
cd dist
dir
- name: Archive Development Artifact
uses: actions/upload-artifact@v3
with:
name: dist
path: |
app/dist/ph-regions-win.exe
app/dist/ph-provinces-win.exe
retention-days: 1
release:
name: Release Built Binary
needs: build-on-win
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: dist
- name: Prepare App
run: |
mv ph-provinces-win.exe ph-provinces-win_${{github.ref_name}}.exe
mv ph-regions-win.exe ph-regions-win_${{github.ref_name}}.exe
tar cvfz ph-regions-win_${{github.ref_name}}.tar.gz ph-regions-win_${{github.ref_name}}.exe
tar cvfz ph-provinces-win_${{github.ref_name}}.tar.gz ph-provinces-win_${{github.ref_name}}.exe
ls -l -a
- name: Attach Artifact to Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
ph-regions-win_${{github.ref_name}}.tar.gz
ph-provinces-win_${{github.ref_name}}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-npm:
name: Publish to NPM registry
runs-on: ubuntu-latest
needs: build-on-win
steps:
- name: Checkout the repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}
- name: Use NodeJS v16.14.2
uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: Publish package
run: |
cp README.md app/
# Exclude examples
rm -r -f /app/examples
cd app
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}