diff --git a/.github/scripts/generate-release-note.js b/.github/scripts/generate-release-note.js new file mode 100644 index 000000000..eb67429d8 --- /dev/null +++ b/.github/scripts/generate-release-note.js @@ -0,0 +1,65 @@ +const fs = require('fs'); + +const version = process.env.VERSION || (process.env.GITHUB_REF_NAME ? process.env.GITHUB_REF_NAME.replace(/^v/, '') : '0.0.0'); +const repo = process.env.GITHUB_REPOSITORY || 'binaricat/netcatty'; +const tag = process.env.GITHUB_REF_NAME || `v${version}`; +const baseUrl = `https://github.com/${repo}/releases/download/${tag}`; + +// Filename patterns based on electron-builder.config.cjs artifactName: '${productName}-${version}-${os}-${arch}.${ext}' +const files = { + mac: { + arm64: `Netcatty-${version}-mac-arm64.dmg`, + x64: `Netcatty-${version}-mac-x64.dmg` + }, + win: { + x64: `Netcatty-${version}-win-x64.exe`, + arm64: `Netcatty-${version}-win-arm64.exe` + }, + linux: { + appimage: { + x64: `Netcatty-${version}-linux-x64.AppImage`, + arm64: `Netcatty-${version}-linux-arm64.AppImage` + }, + deb: { + x64: `Netcatty-${version}-linux-x64.deb`, + arm64: `Netcatty-${version}-linux-arm64.deb` + }, + rpm: { + x64: `Netcatty-${version}-linux-x64.rpm`, + arm64: `Netcatty-${version}-linux-arm64.rpm` + } + } +}; + +const badges = { + win: { + setup_x64: `[![Setup x64](https://img.shields.io/badge/Setup-x64-0078D6?style=flat-square&logo=windows)](${baseUrl}/${files.win.x64})`, + setup_arm64: `[![Setup arm64](https://img.shields.io/badge/Setup-arm64-0078D6?style=flat-square&logo=windows)](${baseUrl}/${files.win.arm64})` + }, + mac: { + apple_silicon: `[![DMG Apple Silicon](https://img.shields.io/badge/DMG-Apple_Silicon-000000?style=flat-square&logo=apple)](${baseUrl}/${files.mac.arm64})`, + intel: `[![DMG Intel X64](https://img.shields.io/badge/DMG-Intel_X64-000000?style=flat-square&logo=apple)](${baseUrl}/${files.mac.x64})` + }, + linux: { + appimage_x64: `[![AppImage x64](https://img.shields.io/badge/AppImage-x64-FCC624?style=flat-square&logo=linux)](${baseUrl}/${files.linux.appimage.x64})`, + appimage_arm64: `[![AppImage arm64](https://img.shields.io/badge/AppImage-arm64-FCC624?style=flat-square&logo=linux)](${baseUrl}/${files.linux.appimage.arm64})`, + deb_x64: `[![DebPackage x64](https://img.shields.io/badge/DebPackage-x64-A80030?style=flat-square&logo=debian)](${baseUrl}/${files.linux.deb.x64})`, + deb_arm64: `[![DebPackage arm64](https://img.shields.io/badge/DebPackage-arm64-A80030?style=flat-square&logo=debian)](${baseUrl}/${files.linux.deb.arm64})`, + rpm_x64: `[![RpmPackage x64](https://img.shields.io/badge/RpmPackage-x64-CC0000?style=flat-square&logo=redhat)](${baseUrl}/${files.linux.rpm.x64})`, + rpm_arm64: `[![RpmPackage arm64](https://img.shields.io/badge/RpmPackage-arm64-CC0000?style=flat-square&logo=redhat)](${baseUrl}/${files.linux.rpm.arm64})` + } +}; + +const content = ` +## Download based on your OS: + +| OS | Download | +| :--- | :--- | +| **Android** | Coming soon... | +| **Windows** | ${badges.win.setup_x64} ${badges.win.setup_arm64} | +| **macOS** | ${badges.mac.apple_silicon} ${badges.mac.intel} | +| **Linux** | ${badges.linux.appimage_x64} ${badges.linux.deb_x64} ${badges.linux.rpm_x64}
${badges.linux.appimage_arm64} ${badges.linux.deb_arm64} ${badges.linux.rpm_arm64} | +`; + +fs.writeFileSync('release_notes.md', content); +console.log('Generated release_notes.md'); diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 172dc20d8..62b473fb7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -101,20 +101,22 @@ jobs: - 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/*.zip artifacts/*.exe - artifacts/*.msi artifacts/*.AppImage artifacts/*.deb artifacts/*.rpm - artifacts/*.tar.gz - artifacts/*.blockmap - artifacts/latest*.yml generate_release_notes: true fail_on_unmatched_files: false token: ${{ secrets.RELEASE_TOKEN }} diff --git a/electron-builder.config.cjs b/electron-builder.config.cjs index 1f306992b..dd0db9f49 100644 --- a/electron-builder.config.cjs +++ b/electron-builder.config.cjs @@ -73,11 +73,7 @@ module.exports = { target: [ { target: 'nsis', - arch: ['x64'] - }, - { - target: 'dir', - arch: ['x64'] + arch: ['x64', 'arm64'] } ] },