From f71bb8a2e3be6d9f44d4be81ebd1b882f3ca2522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E7=9D=BF?= Date: Mon, 16 Mar 2026 14:54:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81=E9=85=8D=E7=BD=AE=EF=BC=8C=E6=8F=90=E5=8D=87?= =?UTF-8?q?=E8=B4=A8=E9=87=8F=E6=A3=80=E6=9F=A5=E5=92=8C=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E7=9A=84=E7=A8=B3=E5=AE=9A=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/check.yaml | 6 +-- .github/workflows/release.yml | 96 +---------------------------------- 2 files changed, 2 insertions(+), 100 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index b9486c3..95d06ba 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -3,11 +3,7 @@ name: Quality Check on: workflow_call: push: - branches: - - main pull_request: - branches: - - main jobs: check: @@ -19,7 +15,7 @@ jobs: targets: [x86_64-unknown-linux-gnu] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@nightly with: toolchain: ${{ matrix.rust-toolchain }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f3c1715..e009fd9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,6 @@ on: workflows: ["Quality Check"] branches: [main] types: [completed] - workflow_dispatch: permissions: contents: write @@ -13,7 +12,7 @@ permissions: jobs: release-plz: - if: ${{ github.repository_owner == 'drivercraft' && (github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success') }} + if: ${{ github.repository_owner == 'drivercraft' && github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-22.04 steps: - &checkout @@ -39,96 +38,3 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - # Create a PR with the new versions and changelog, preparing the next release. - release-plz-pr: - name: Release-plz PR - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - concurrency: - group: release-plz-${{ github.ref }} - cancel-in-progress: false - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - *install-rust - - *setup-libudenv - - name: Run release-plz - uses: release-plz/action@v0.5 - with: - command: release-pr - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - - build-binaries: - needs: release-plz - if: ${{ needs.release-plz.result == 'success' }} - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable - with: - targets: x86_64-unknown-linux-gnu - - - name: Install dependencies - run: sudo apt-get update && sudo apt-get install -y libudev-dev - - - name: Cache cargo - uses: Swatinem/rust-cache@v2 - - - name: Compute version and tag - id: meta - run: | - version=$(grep -m1 '^version' ostool/Cargo.toml | sed -E 's/version = "([^"]+)"/\1/') - echo "version=$version" >> "$GITHUB_OUTPUT" - echo "tag=ostool-v$version" >> "$GITHUB_OUTPUT" - echo "target=x86_64-unknown-linux-gnu" >> "$GITHUB_OUTPUT" - - - name: Check release exists - id: release_check - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if gh release view "${{ steps.meta.outputs.tag }}" >/dev/null 2>&1; then - echo "exists=true" >> "$GITHUB_OUTPUT" - else - echo "exists=false" >> "$GITHUB_OUTPUT" - fi - - - name: Build binaries - if: steps.release_check.outputs.exists == 'true' - run: | - cargo build --release -p ostool --bin ostool --target ${{ steps.meta.outputs.target }} - cargo build --release -p ostool --bin cargo-osrun --target ${{ steps.meta.outputs.target }} - - - name: Package artifacts - if: steps.release_check.outputs.exists == 'true' - run: | - version="${{ steps.meta.outputs.version }}" - target="${{ steps.meta.outputs.target }}" - dist="dist/ostool-${target}-v${version}" - mkdir -p "$dist" - cp "target/${target}/release/ostool" "$dist/" - cp "target/${target}/release/cargo-osrun" "$dist/" - tar -czf "ostool-${target}-v${version}.tar.gz" -C dist "ostool-${target}-v${version}" - sha256sum "ostool-${target}-v${version}.tar.gz" > "ostool-${target}-v${version}.tar.gz.sha256" - - - name: Upload release assets - if: steps.release_check.outputs.exists == 'true' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - version="${{ steps.meta.outputs.version }}" - target="${{ steps.meta.outputs.target }}" - tag="${{ steps.meta.outputs.tag }}" - gh release upload "$tag" \ - "ostool-${target}-v${version}.tar.gz" \ - "ostool-${target}-v${version}.tar.gz.sha256" \ - --clobber From 5e500761b0d2fea90f785428ff45b07048227c21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E7=9D=BF?= Date: Mon, 16 Mar 2026 15:03:28 +0800 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=20release.yml?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E5=8D=87=E5=B7=A5=E4=BD=9C=E6=B5=81=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=92=8C=E4=BE=9D=E8=B5=96=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e009fd9..5388886 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,12 +12,12 @@ permissions: jobs: release-plz: - if: ${{ github.repository_owner == 'drivercraft' && github.event.workflow_run.conclusion == 'success' }} + if: &release_condition ${{ github.repository_owner == 'drivercraft' && github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-22.04 steps: - &checkout name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 persist-credentials: false @@ -35,6 +35,23 @@ jobs: uses: release-plz/action@v0.5 with: command: release - env: + env: &release_env GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + + release-plz-pr: + name: Release-plz PR + if: *release_condition + runs-on: ubuntu-22.04 + concurrency: + group: release-plz-pr-${{ github.ref }} + cancel-in-progress: false + steps: + - *checkout + - *install-rust + - *setup-libudenv + - name: Run release-plz + uses: release-plz/action@v0.5 + with: + command: release-pr + env: *release_env