Merge pull request #5 from qlrd/dependabot/npm_and_yarn/electron/nota… #11
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: Build | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- "**.md" | |
- "**.spec.js" | |
- ".idea" | |
- ".vscode" | |
- ".dockerignore" | |
- "Dockerfile" | |
- ".gitignore" | |
- ".github/**" | |
- "!.github/workflows/build.yml" | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install Dependencies | |
run: npm install | |
- name: Build Release Files | |
run: npm run build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get version (Linux) | |
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} | |
id: unix-version | |
run: | | |
APP_NAME=`node -e "console.log(require('./package.json').name)"` | |
APP_VERSION=`node -e "console.log(require('./package.json').version)"` | |
echo "app-version=$APP_VERSION" >> $GITHUB_OUTPUT | |
echo "app-name=$APP_NAME" >> $GITHUB_OUTPUT | |
- name: Get version (Windows) | |
if: ${{ runner.os == 'Windows' }} | |
id: win-version | |
shell: pwsh | |
run: | | |
$app_name = node -e "console.log(require('./package.json').name)" | |
$app_version = node -e "console.log(require('./package.json').version)" | |
echo "app-version=$app_version" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append | |
echo "app-name=$app_name" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append | |
- name: List generated Files (Linux or MacOS) | |
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} | |
run: ls -la release/${{ steps.unix-version.outputs.app-version }} | |
- name: List generated Files (Windows) | |
if: ${{ runner.os == 'Windows' }} | |
shell: pwsh | |
run: ls release\${{ steps.win-version.outputs.app-version }} | |
- name: Sha256sum Release Files (AppImage) | |
if: ${{ runner.os == 'Linux' }} | |
uses: qlrd/sha256sum-action@v2 | |
with: | |
working-directory: release/${{ steps.unix-version.outputs.app-version }} | |
file: ${{ steps.unix-version.outputs.app-name }}-${{ steps.unix-version.outputs.app-version }}.AppImage | |
ext: 'sha256.txt' | |
- name: Sha256sum Release Files (Snap) | |
if: ${{ runner.os == 'Linux' }} | |
uses: qlrd/sha256sum-action@v2 | |
with: | |
working-directory: release/${{ steps.unix-version.outputs.app-version }} | |
file: ${{ steps.unix-version.outputs.app-name }}-${{ steps.unix-version.outputs.app-version }}.snap | |
ext: 'sha25.txt' | |
- name: Sha256sum Release Files (Dmg) | |
if: ${{ runner.os == 'macOS' }} | |
uses: qlrd/sha256sum-action@v2 | |
with: | |
working-directory: release/${{ steps.unix-version.outputs.app-version }} | |
file: ${{ steps.unix-version.outputs.app-name }}-${{ steps.unix-version.outputs.app-version }}.dmg | |
ext: 'sha256.txt' | |
- name: Sha256sum Release Files (Nsis) | |
if: ${{ runner.os == 'Windows' }} | |
uses: qlrd/sha256sum-action@v2 | |
with: | |
working-directory: release/${{ steps.win-version.outputs.app-version }} | |
file: ${{ steps.win-version.outputs.app-name }}-${{ steps.win-version.outputs.app-version }}.exe | |
ext: 'sha256.txt' | |
- name: Upload Artifact (AppImage) | |
if: ${{ runner.os == 'Linux' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ runner.os }}-${{ steps.unix-version.outputs.app-name}}-v${{ steps.unix-version.outputs.app-version }}.AppImage | |
path: | | |
release/${{ steps.unix-version.outputs.app-version }}/${{ steps.unix-version.outputs.app-name }}-${{ steps.unix-version.outputs.app-version }}.AppImage | |
release/${{ steps.unix-version.outputs.app-version }}/${{ steps.unix-version.outputs.app-name }}-${{ steps.unix-version.outputs.app-version }}.AppImage.sha256.txt | |
retention-days: 5 | |
- name: Upload Artifact (Snap) | |
if: ${{ runner.os == 'Linux' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ runner.os }}-${{ steps.unix-version.outputs.app-name}}-v${{ steps.unix-version.outputs.app-version }}.snap | |
path: | | |
release/${{ steps.unix-version.outputs.app-version }}/${{ steps.unix-version.outputs.app-name }}-${{ steps.unix-version.outputs.app-version }}.snap | |
release/${{ steps.unix-version.outputs.app-version }}/${{ steps.unix-version.outputs.app-name }}-${{ steps.unix-version.outputs.app-version }}.snap.sha256.txt | |
retention-days: 5 | |
- name: Upload Artifact (Dmg) | |
if: ${{ runner.os == 'macOS' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ runner.os }}-${{ steps.unix-version.outputs.app-name}}-v${{ steps.unix-version.outputs.app-version }}.dmg | |
path: | | |
release/${{ steps.unix-version.outputs.app-version }}/${{ steps.unix-version.outputs.app-name }}-${{ steps.unix-version.outputs.app-version }}.dmg | |
release/${{ steps.unix-version.outputs.app-version }}/${{ steps.unix-version.outputs.app-name }}-${{ steps.unix-version.outputs.app-version }}.dmg.sha256.txt | |
retention-days: 5 | |
- name: Upload Artifact (NSIS) | |
if: ${{ runner.os == 'Windows' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ runner.os }}-${{ steps.win-version.outputs.app-name}}-v${{ steps.win-version.outputs.app-version }}.exe | |
path: | | |
release/${{ steps.win-version.outputs.app-version }}/${{ steps.win-version.outputs.app-name }}-${{ steps.win-version.outputs.app-version }}.exe | |
release/${{ steps.win-version.outputs.app-version }}/${{ steps.win-version.outputs.app-name }}-${{ steps.win-version.outputs.app-version }}.exe.sha256.txt | |
retention-days: 5 |