From eb00380b5ff15c2f557a55b4580309b6e906392d Mon Sep 17 00:00:00 2001 From: Felipe Coury Date: Tue, 2 Jul 2024 16:45:24 -0300 Subject: [PATCH] feat: release GitHub action --- .github/workflows/release.yml | 76 +++++++++++++++++++++++++++++++++++ 1 file changed, 76 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..5ad443b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,76 @@ +name: Release + +on: + push: + tags: + - "v*.*.*" # Matches version tags like v1.0.0 + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + target: + - x86_64-unknown-linux-gnu + - aarch64-unknown-linux-gnu + - x86_64-pc-windows-msvc + - aarch64-pc-windows-msvc + - x86_64-apple-darwin + - aarch64-apple-darwin + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - name: Install cross + run: cargo install cross + + - name: Build + run: cross build --release --target ${{ matrix.target }} + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.target }}-release + path: target/${{ matrix.target }}/release/ + + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: ${{ matrix.target }}-release + path: ./artifacts + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./artifacts + asset_name: ${{ matrix.target }}-release + asset_content_type: application/zip