Merge pull request #888 from etsiej/patch-1 #399
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: CI Build | |
on: [push, pull_request] | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
jobs: | |
build: | |
name: Build all | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@v4 | |
name: Read repository | |
- name: Set up Node.js 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
- name: Get package.json info | |
id: info | |
uses: jaywcjlove/github-action-package@main | |
- name: Load cache | |
id: load-cache-node_modules | |
uses: actions/cache/restore@v3 | |
with: | |
path: ./node_modules | |
key: node_modules-${{ hashFiles('package-lock.json') }} | |
enableCrossOsArchive: true | |
- name: Prepare dependencies for cache | |
if: steps.load-cache-node_modules.outputs.cache-hit != 'true' | |
run: npm i --install-links | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Save cache | |
if: steps.load-cache-node_modules.outputs.cache-hit != 'true' | |
id: save-cache-node_modules | |
uses: actions/cache/save@v3 | |
with: | |
path: ./node_modules | |
key: ${{ steps.load-cache-node_modules.outputs.cache-primary-key }} | |
enableCrossOsArchive: true | |
- name: Build assets | |
run: npm run parcel-build | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Win32 installer | |
run: npm exec electron-builder -- --x64 --config.extraMetadata.versionBuild="${{ steps.info.outputs.version }}+${{ github.sha }}" --config.win.artifactName="Twinkle.Tray.v${{ steps.info.outputs.version }}.exe" --publish="never" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/upload-artifact@v4 | |
name: Upload Win32 installer | |
with: | |
name: twinkle-tray-exe-${{ steps.info.outputs.version }}-${{ github.sha }} | |
path: dist/*.exe | |
- name: Build x64 AppX | |
if: ${{ env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'ci-test' }} | |
run: npm exec electron-builder -- --x64 --win appx --config.npmRebuild=false --config.extraMetadata.versionBuild="${{ steps.info.outputs.version }}+${{ github.sha }}" --config.extraMetadata.name=twinkle-tray-appx --config.win.artifactName="Twinkle.Tray.v${{ steps.info.outputs.version }}-store.appx" --publish="never" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/upload-artifact@v4 | |
name: Upload x64 AppX | |
if: ${{ env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'ci-test' }} | |
with: | |
name: twinkle-tray-appx-x64-${{ steps.info.outputs.version }}-${{ github.sha }} | |
path: dist/*-store.appx | |
- name: Build ARM64 AppX | |
if: ${{ env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'ci-test' }} | |
run: npm exec electron-builder -- --arm64 --win appx --config.extraMetadata.versionBuild="${{ steps.info.outputs.version }}+${{ github.sha }}" --config.extraMetadata.name=twinkle-tray-appx --config.win.artifactName="Twinkle.Tray.v${{ steps.info.outputs.version }}-store-arm64.appx" --publish="never" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/upload-artifact@v4 | |
name: Upload ARM64 AppX | |
if: ${{ env.BRANCH_NAME == 'master' || env.BRANCH_NAME == 'ci-test' }} | |
with: | |
name: twinkle-tray-appx-arm64-${{ steps.info.outputs.version }}-${{ github.sha }} | |
path: dist/*-store-arm64.appx |