diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 623cf46..b23918c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,16 +3,19 @@ name: Release permissions: contents: write -on: - push: - tags: - - v[0-9]+.* +on: [push] + +defaults: + run: + shell: bash --noprofile --norc -CeEuo pipefail {0} + jobs: create-release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: taiki-e/create-gh-release-action@v1 + if: startsWith(github.ref, 'refs/tags/') with: token: ${{ secrets.GITHUB_TOKEN }} @@ -21,8 +24,6 @@ jobs: strategy: matrix: include: - - target: x86_64-unknown-linux-musl - os: ubuntu-latest - target: x86_64-apple-darwin os: macos-latest - target: aarch64-apple-darwin @@ -30,15 +31,50 @@ jobs: - target: x86_64-pc-windows-msvc os: windows-latest RUSTFLAGS: -C target-feature=+crt-static + - target: x86_64-pc-windows-gnu + os: windows-latest + - target: arm64ec-pc-windows-msvc + os: windows-latest - target: aarch64-unknown-linux-musl os: ubuntu-latest + - target: aarch64-unknown-linux-gnu + os: ubuntu-latest + - target: x86_64-unknown-linux-musl + os: ubuntu-latest + - target: x86_64-unknown-linux-gnu + os: ubuntu-latest runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 + # - uses: actions-rust-lang/setup-rust-toolchain@v1 + # with: + # rustflags: "-A warnings" + # toolchain: "nightly" - uses: taiki-e/upload-rust-binary-action@v1 with: + dry-run: ${{ !startsWith(github.ref, 'refs/tags/') }} bin: osvg target: ${{ matrix.target }} token: ${{ secrets.GITHUB_TOKEN }} + # ref: refs/tags/dummy + ref: ${{ startsWith(github.ref, 'refs/tags/') && github.ref || 'refs/tags/dummy' }} + features: cli env: - RUSTFLAGS: ${{ matrix.RUSTFLAGS }} \ No newline at end of file + RUSTFLAGS: ${{ matrix.RUSTFLAGS }} + - name: Get target name for artifact + id: artifact-target + run: | + target="${{ matrix.target }}" + if [[ -z "${target}" ]]; then + host=$(rustc -vV | grep -E '^host:' | cut -d' ' -f2) + printf '%s\n' "artifact-target=${host}" >>"${GITHUB_OUTPUT}" + elif [[ "${{ matrix.build-tool }}" == 'cargo-zigbuild' ]]; then + printf '%s\n' "artifact-target=${target%%.*}" >>"${GITHUB_OUTPUT}" + else + printf '%s\n' "artifact-target=${target}" >>"${GITHUB_OUTPUT}" + fi + # For debugging + - uses: actions/upload-artifact@v4 + with: + name: osvg-${{ steps.artifact-target.outputs.artifact-target }} + path: osvg-${{ steps.artifact-target.outputs.artifact-target }}.*