Build & Release #8
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: Build & Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| prerelease: | |
| description: 'Mark as pre-release' | |
| type: boolean | |
| default: true | |
| jobs: | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Download yt-dlp (Linux) | |
| run: | | |
| mkdir -p bin/linux | |
| curl -L -o bin/linux/yt-dlp https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp | |
| chmod +x bin/linux/yt-dlp | |
| - name: Build & Publish Linux | |
| run: npm run publish | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-windows: | |
| runs-on: windows-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Download yt-dlp (Windows) | |
| run: | | |
| New-Item -ItemType Directory -Force -Path bin\win | |
| Invoke-WebRequest -Uri "https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe" -OutFile "bin\win\yt-dlp.exe" | |
| - name: Build & Publish Windows | |
| run: npm run publish:win | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-macos: | |
| runs-on: macos-15 | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build & Publish macOS | |
| run: npm run publish:mac | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| finalize: | |
| needs: [build-linux, build-windows, build-macos] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Publish release | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| gh release edit "v${VERSION}" \ | |
| --draft=false \ | |
| --prerelease=${{ inputs.prerelease }} \ | |
| --title "Snowify v${VERSION}" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |