diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..de70c4b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - run: cargo check --workspace + - run: cargo test --workspace + + build: + needs: check + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Install Windows target + run: | + rustup target add x86_64-pc-windows-gnu + sudo apt-get update && sudo apt-get install -y mingw-w64 + - name: Build Linux + run: cargo build --release + - name: Build Windows + run: cargo build --release --target x86_64-pc-windows-gnu + - name: Package + run: | + mkdir -p builds + cp target/release/notalterra notalterra + tar -czf builds/notalterra-${GITHUB_REF_NAME}-linux-amd64.tar.gz notalterra + cp target/x86_64-pc-windows-gnu/release/notalterra.exe NotAlterra.exe + zip -q builds/notalterra-${GITHUB_REF_NAME}-windows-x64.zip NotAlterra.exe + - name: Upload to release + uses: softprops/action-gh-release@v2 + with: + files: builds/* + body_path: _release.md