From eea7bfa1143ae959f2efa03569131fc33fcd2510 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Wed, 27 Sep 2023 01:18:42 +0200 Subject: [PATCH] Publish binaries on release --- .github/workflows/release.yml | 64 +++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..952e755 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,64 @@ +name: Release + +on: + push: + tags: + - '[0-9]+.*' + +jobs: + create-release: + name: "Create GitHub release" + # only publish from the origin repository + if: github.repository_owner == 'fornwall' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: taiki-e/create-gh-release-action@v1 + with: + changelog: CHANGELOG.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + crates: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: publish package to crates + run: | + cargo package + cargo publish --token ${{ secrets.CARGO_TOKEN }} + + binaries: + name: "Upload release binaries" + needs: + - create-release + strategy: + fail-fast: false + matrix: + include: + - target: x86_64-unknown-linux-gnu + os: ubuntu-latest + - target: x86_64-unknown-linux-musl + os: ubuntu-latest + - target: x86_64-apple-darwin + os: macos-latest + - target: x86_64-pc-windows-msvc + os: windows-latest + - target: aarch64-unknown-linux-gnu + os: ubuntu-latest + - target: aarch64-unknown-linux-musl + os: ubuntu-latest + - target: aarch64-apple-darwin + os: macos-latest + - target: universal-apple-darwin + os: macos-latest + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: taiki-e/upload-rust-binary-action@v1 + with: + bin: rust-script + target: ${{ matrix.target }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}