ph-municipalities_v1.4.1 #36
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
test-app: | |
name: Lint and Test App | |
runs-on: ubuntu-latest | |
env: | |
EXCEL_FILE_URL: ${{ secrets.EXCEL_FILE_URL }} | |
SHEETJS_COLUMN: ${{ secrets.SHEETJS_COLUMN }} | |
SORT_ALPHABETICAL: ${{ secrets.SORT_ALPHABETICAL }} | |
SPECIAL_CHARACTERS: ${{ secrets.SPECIAL_CHARACTERS }} | |
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: Install Dependencies | |
run: | | |
cd app | |
npm install | |
- name: Lint App | |
run: | | |
cd app | |
npm run lint | |
- name: Test App | |
run: | | |
cd app | |
npm test | |
build-on-win: | |
name: Build and Package App | |
runs-on: windows-latest | |
needs: test-app | |
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 | |
env: | |
IMAGE_URL: ${{ secrets.IMAGE_URL }} | |
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: | | |
chmod u+x scripts/npm-publish.sh | |
./scripts/npm-publish.sh | |
cd app | |
npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |