mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
120 lines
3.2 KiB
YAML
120 lines
3.2 KiB
YAML
name: build-packages
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
publish_release:
|
|
description: "Publish GitHub Release after build"
|
|
type: boolean
|
|
default: false
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
jobs:
|
|
build:
|
|
name: build-${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
|
env:
|
|
VITE_SYNC_GITHUB_CLIENT_ID: ${{ secrets.VITE_SYNC_GITHUB_CLIENT_ID }}
|
|
VITE_SYNC_GOOGLE_CLIENT_ID: ${{ secrets.VITE_SYNC_GOOGLE_CLIENT_ID }}
|
|
VITE_SYNC_GOOGLE_CLIENT_SECRET: ${{ secrets.VITE_SYNC_GOOGLE_CLIENT_SECRET }}
|
|
VITE_SYNC_ONEDRIVE_CLIENT_ID: ${{ secrets.VITE_SYNC_ONEDRIVE_CLIENT_ID }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: npm
|
|
|
|
- name: Install deps
|
|
run: npm ci
|
|
|
|
- name: Set version from tag
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
shell: bash
|
|
run: |
|
|
VERSION="${GITHUB_REF_NAME#v}"
|
|
echo "Setting version to ${VERSION}"
|
|
npm pkg set version="${VERSION}"
|
|
|
|
- name: Build package (macOS)
|
|
if: matrix.os == 'macos-latest'
|
|
env:
|
|
CSC_IDENTITY_AUTO_DISCOVERY: "false"
|
|
ELECTRON_BUILDER_PUBLISH: "never"
|
|
run: npm run pack:mac
|
|
|
|
- name: Build package (Windows)
|
|
if: matrix.os == 'windows-latest'
|
|
env:
|
|
ELECTRON_BUILDER_PUBLISH: "never"
|
|
run: npm run pack:win
|
|
|
|
- name: Build package (Linux)
|
|
if: matrix.os == 'ubuntu-latest'
|
|
env:
|
|
ELECTRON_BUILDER_PUBLISH: "never"
|
|
run: npm run pack:linux
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: netcatty-${{ matrix.os }}
|
|
path: |
|
|
release/*.dmg
|
|
release/*.exe
|
|
release/*.msi
|
|
release/*.AppImage
|
|
release/*.deb
|
|
release/*.rpm
|
|
release/*.tar.gz
|
|
if-no-files-found: ignore
|
|
|
|
release:
|
|
name: release
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && inputs.publish_release)
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
merge-multiple: true
|
|
|
|
- name: List artifacts
|
|
run: ls -la artifacts/
|
|
|
|
- name: Generate Release Body
|
|
run: node .github/scripts/generate-release-note.js
|
|
env:
|
|
GITHUB_REF_NAME: ${{ github.ref_name }}
|
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
body_path: release_notes.md
|
|
files: |
|
|
artifacts/*.dmg
|
|
artifacts/*.exe
|
|
artifacts/*.AppImage
|
|
artifacts/*.deb
|
|
artifacts/*.rpm
|
|
generate_release_notes: true
|
|
fail_on_unmatched_files: false
|
|
token: ${{ secrets.RELEASE_TOKEN }}
|