chore(release): 0.57.2 #23
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: Desktop Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-macos: | |
| runs-on: macos-14 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build Next.js | |
| run: npm run build | |
| env: | |
| NEXT_PUBLIC_CONVEX_URL: https://convex.altnautica.com | |
| - name: Compile Electron | |
| run: npm run electron:compile | |
| - name: Build macOS app | |
| run: npx electron-builder --mac --publish always | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-build | |
| path: release/*.dmg | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build Next.js | |
| run: npm run build | |
| env: | |
| NEXT_PUBLIC_CONVEX_URL: https://convex.altnautica.com | |
| - name: Compile Electron | |
| run: npm run electron:compile | |
| - name: Build Windows app | |
| run: npx electron-builder --win --publish always | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-build | |
| path: release/*.exe | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build Next.js | |
| run: npm run build | |
| env: | |
| NEXT_PUBLIC_CONVEX_URL: https://convex.altnautica.com | |
| - name: Compile Electron | |
| run: npm run electron:compile | |
| - name: Build Linux app | |
| run: npx electron-builder --linux --publish always | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-build | |
| path: release/*.AppImage | |
| update-release-notes: | |
| needs: [build-macos, build-windows, build-linux] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Update release notes from CHANGELOG | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const tag = context.ref.replace('refs/tags/', ''); | |
| const version = tag.replace(/^v/, ''); | |
| const changelog = fs.readFileSync('CHANGELOG.md', 'utf8'); | |
| // Match `## [version]` line then capture everything until the next | |
| // `## [` heading (or end of file). Escape dots in the version. | |
| const escaped = version.replace(/\./g, '\\.'); | |
| const re = new RegExp(`^## \\[${escaped}\\][^\\n]*\\n([\\s\\S]*?)(?=^## \\[|$(?![\\s\\S]))`, 'm'); | |
| const match = changelog.match(re); | |
| if (!match) { | |
| core.setFailed(`No CHANGELOG section found for ${version}.`); | |
| return; | |
| } | |
| const body = [ | |
| `## Altnautica Command ${tag}`, | |
| '', | |
| match[1].trim(), | |
| '', | |
| '---', | |
| '', | |
| '### Downloads', | |
| '', | |
| '- **macOS:** `.dmg` (Intel and Apple Silicon)', | |
| '- **Windows:** `.exe` installer', | |
| '- **Linux:** `.AppImage`', | |
| '', | |
| '> For the latest web version, visit [command.altnautica.com](https://command.altnautica.com).', | |
| ].join('\n'); | |
| const { data: releases } = await github.rest.repos.listReleases({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| }); | |
| const release = releases.find(r => r.tag_name === tag); | |
| if (!release) { | |
| core.setFailed(`Release for tag ${tag} not found`); | |
| return; | |
| } | |
| await github.rest.repos.updateRelease({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| release_id: release.id, | |
| draft: false, | |
| body, | |
| }); |