fix workflow #14
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: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-windows: | |
| name: Build Windows (NSIS) | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install cargo-packager (binary) | |
| shell: pwsh | |
| run: | | |
| $url = "https://github.com/crabnebula-dev/cargo-packager/releases/latest/download/cargo-packager_x86_64-pc-windows-msvc.zip" | |
| Invoke-WebRequest -Uri $url -OutFile cargo-packager.zip | |
| Expand-Archive -Path cargo-packager.zip -DestinationPath . | |
| Move-Item -Path cargo-packager.exe -Destination "$HOME\.cargo\bin\cargo-packager.exe" -Force | |
| - name: Build Binary | |
| run: cargo build --release | |
| - name: Build EXE (NSIS) | |
| run: cargo packager --release | |
| - name: Upload EXE | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: astrotool-npfcalc-windows | |
| path: target/release/*-setup.exe | |
| build-linux: | |
| name: Build Linux (tar.gz) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-3-dev libwayland-dev libxkbcommon-dev build-essential | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Build | |
| run: cargo build --release | |
| - name: Create Package | |
| run: | | |
| mkdir -p astrotool-npfcalc | |
| cp target/release/AstroTool-NpfCalc astrotool-npfcalc/ | |
| cp README.md astrotool-npfcalc/ | |
| tar -czvf astrotool-npfcalc-linux.tar.gz astrotool-npfcalc/ | |
| - name: Upload tar.gz | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: astrotool-npfcalc-linux | |
| path: astrotool-npfcalc-linux.tar.gz | |
| release: | |
| name: Create Release | |
| needs: [build-windows, build-linux] | |
| if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| files: | | |
| artifacts/*.exe | |
| artifacts/*.tar.gz |