fix: use free GitHub runners with cross-compilation #16
Workflow file for this run
This file contains hidden or 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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Package | |
| run: npm run dist | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: List release files | |
| run: dir release | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-builds | |
| path: release/* | |
| if-no-files-found: error | |
| build-macos: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Package | |
| run: npm run dist | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: List release files | |
| run: ls -la release/ | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-builds | |
| path: release/* | |
| if-no-files-found: error | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Package | |
| run: npm run dist | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: List release files | |
| run: ls -la release/ | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-builds | |
| path: release/* | |
| if-no-files-found: error | |
| release: | |
| needs: [build-windows, build-macos, build-linux] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download Windows artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-builds | |
| path: release-files | |
| - name: Download macOS artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: macos-builds | |
| path: release-files | |
| - name: Download Linux artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: linux-builds | |
| path: release-files | |
| - name: List all release files | |
| run: ls -la release-files/ | |
| - name: Get version from tag | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: Adnify v${{ steps.version.outputs.VERSION }} | |
| body: | | |
| ## Adnify v${{ steps.version.outputs.VERSION }} | |
| ### 下载 / Downloads | |
| | 平台 | 架构 | 文件 | | |
| |------|------|------| | |
| | Windows 安装版 | x64 | `Adnify-Setup-${{ steps.version.outputs.VERSION }}.exe` | | |
| | Windows 安装版 | arm64 | `Adnify-Setup-${{ steps.version.outputs.VERSION }}-arm64.exe` | | |
| | Windows 便携版 | x64 | `Adnify-${{ steps.version.outputs.VERSION }}-Portable.exe` | | |
| | Windows 便携版 | arm64 | `Adnify-${{ steps.version.outputs.VERSION }}-arm64-Portable.exe` | | |
| | macOS | Intel (x64) | `Adnify-${{ steps.version.outputs.VERSION }}.dmg` | | |
| | macOS | Apple Silicon (arm64) | `Adnify-${{ steps.version.outputs.VERSION }}-arm64.dmg` | | |
| | Linux | x64 | `Adnify-${{ steps.version.outputs.VERSION }}.AppImage` | | |
| | Linux | arm64 | `Adnify-${{ steps.version.outputs.VERSION }}-arm64.AppImage` | | |
| ### 安装说明 | |
| - **Windows**: 下载对应架构的 Setup.exe 运行安装,或下载 Portable 版本直接运行 | |
| - **macOS**: 下载对应架构的 .dmg 拖入 Applications。如提示"已损坏",请在终端执行:`xattr -cr /Applications/Adnify.app` | |
| - **Linux**: 下载对应架构的 .AppImage,`chmod +x` 后运行 | |
| > 💡 不确定架构?Windows 大多数电脑选 x64,M1/M2/M3 Mac 选 arm64,Intel Mac 选 x64 | |
| --- | |
| 📦 [Gitee 镜像](https://gitee.com/adnaan/adnify/releases/tag/v${{ steps.version.outputs.VERSION }}) | |
| files: | | |
| release-files/*.exe | |
| release-files/*.dmg | |
| release-files/*.zip | |
| release-files/*.AppImage | |
| release-files/*.tar.gz | |
| fail_on_unmatched_files: false | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| sync-to-gitee: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Sync to Gitee | |
| run: | | |
| git remote add gitee https://${{ secrets.GITEE_USERNAME }}:${{ secrets.GITEE_TOKEN }}@gitee.com/adnaan/adnify.git | |
| git push gitee --all --force | |
| git push gitee --tags --force | |
| continue-on-error: true |