Skip to content

simplify matrix

simplify matrix #4

Workflow file for this run

name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build on ${{ matrix.os }} for ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: x86_64
target: x86_64-unknown-linux-gnu
- os: macos-latest
arch: ARM64
target: aarch64-apple-darwin
- os: macos-latest
arch: x86_64
target: x86_64-apple-darwin
- os: windows-latest
arch: x86_64
target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: ${{ matrix.target }}
- name: Build binary
run: cargo build --release --target ${{ matrix.target }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: py-init-cleaner-${{ matrix.target }}
path: target/${{ matrix.target }}/release/py-init-cleaner
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
- 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
run: |
for filename in py-init-cleaner-*; do
echo "Uploading $filename"
asset_path="./$filename"
asset_name="$filename"
asset_content_type="application/octet-stream"
curl \
-X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: $asset_content_type" \
-H "Accept: application/vnd.github.v3+json" \
--data-binary @$asset_path \
"${{ steps.create_release.outputs.upload_url }}?name=$(urlencode $asset_name)"
done
shell: bash