Add Windows popcorn alias (#71) #222
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: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| version: | |
| name: Generate Version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| new_tag: ${{ steps.tag_version.outputs.new_tag }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Bump version and push tag | |
| id: tag_version | |
| uses: mathieudutour/github-tag-action@v6.1 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| default_bump: patch | |
| release_branches: main | |
| build: | |
| name: Build | |
| needs: version | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| artifact_name: popcorn-cli | |
| asset_name: popcorn-cli-linux.tar.gz | |
| compress_cmd: tar -czf | |
| compress_ext: .tar.gz | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| artifact_name: popcorn-cli | |
| asset_name: popcorn-cli-windows.zip | |
| compress_cmd: 7z a | |
| compress_ext: .zip | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| artifact_name: popcorn-cli | |
| asset_name: popcorn-cli-macos.tar.gz | |
| compress_cmd: tar -czf | |
| compress_ext: .tar.gz | |
| - os: ubuntu-24.04-arm | |
| target: aarch64-unknown-linux-gnu | |
| artifact_name: popcorn-cli | |
| asset_name: popcorn-cli-linux-aarch64.tar.gz | |
| compress_cmd: tar -czf | |
| compress_ext: .tar.gz | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| targets: ${{ matrix.target }} | |
| - name: Set up cargo cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.target }} | |
| - name: Install musl tools (Linux musl) | |
| if: matrix.target == 'x86_64-unknown-linux-musl' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools | |
| - name: Build release binary | |
| run: cargo build --release --target ${{ matrix.target }} | |
| env: | |
| CLI_VERSION: ${{ needs.version.outputs.new_tag }} | |
| - name: Prepare artifact | |
| shell: bash | |
| run: | | |
| mkdir -p dist | |
| if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
| cp target/${{ matrix.target }}/release/popcorn-cli.exe dist/popcorn-cli.exe | |
| else | |
| cp target/${{ matrix.target }}/release/popcorn-cli dist/popcorn-cli | |
| chmod +x dist/popcorn-cli | |
| fi | |
| cd dist | |
| ${{ matrix.compress_cmd }} ../${{ matrix.asset_name }} * | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.asset_name }} | |
| path: ${{ matrix.asset_name }} | |
| retention-days: 7 | |
| release: | |
| name: Create Release | |
| needs: [build, version] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ needs.version.outputs.new_tag }} | |
| name: Release ${{ needs.version.outputs.new_tag }} | |
| body: | | |
| Download the archive for your platform: | |
| - Linux x86_64: `popcorn-cli-linux.tar.gz` | |
| - Linux aarch64: `popcorn-cli-linux-aarch64.tar.gz` | |
| - macOS Apple Silicon: `popcorn-cli-macos.tar.gz` | |
| - Windows x86_64: `popcorn-cli-windows.zip` | |
| Extract the archive, move `popcorn-cli` into a directory on your `PATH`, | |
| and run `popcorn --version` to confirm the installed version. | |
| files: | | |
| popcorn-cli-linux.tar.gz/popcorn-cli-linux.tar.gz | |
| popcorn-cli-linux-aarch64.tar.gz/popcorn-cli-linux-aarch64.tar.gz | |
| popcorn-cli-windows.zip/popcorn-cli-windows.zip | |
| popcorn-cli-macos.tar.gz/popcorn-cli-macos.tar.gz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |