[Fix]: Fixed an issue in release.yml where check and test were reused… #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| - 'v*.*.*-pre.*' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| check: | |
| if: github.repository_owner == 'arceos-hypervisor' | |
| name: Check | |
| uses: ./.github/workflows/check.yml | |
| test: | |
| if: github.repository_owner == 'arceos-hypervisor' | |
| name: Test | |
| uses: ./.github/workflows/test.yml | |
| needs: check | |
| publish-crates: | |
| if: github.repository_owner == 'arceos-hypervisor' | |
| name: Publish to crates.io | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Validate tag and branch (HEAD-based) | |
| shell: bash | |
| run: | | |
| set -e | |
| TAG="${{ github.ref_name }}" | |
| TAG_COMMIT=$(git rev-list -n 1 "$TAG") | |
| git fetch origin no_std | |
| NO_STD_HEAD=$(git rev-parse origin/no_std) | |
| echo "Tag: $TAG" | |
| echo "Tag commit: $TAG_COMMIT" | |
| echo "no_std HEAD: $NO_STD_HEAD" | |
| if [ "$TAG_COMMIT" != "$NO_STD_HEAD" ]; then | |
| echo "❌ release tag must be created from no_std HEAD" | |
| exit 1 | |
| fi | |
| echo "✅ tag validated on no_std" | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Publish to crates.io | |
| run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| create-release: | |
| if: github.repository_owner == 'arceos-hypervisor' | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: publish-crates | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| draft: false | |
| prerelease: ${{ contains(github.ref_name, '-pre.') }} | |
| generate_release_notes: true | |
| body: | | |
| ## ${{ github.ref_name }} | |
| - Documentation: https://docs.rs/range-alloc-arceos | |
| - crates.io: https://crates.io/crates/range-alloc-arceos |