axvmconfig 0.4.3

A simple VM configuration tool for ArceOS-Hypervisor.
Documentation
name: Deploy

on:
  push:
    tags:
      - 'v[0-9]+.[0-9]+.[0-9]+'

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: 'pages'
  cancel-in-progress: false

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1

jobs:
  verify-tag:
    name: Verify Tag
    runs-on: ubuntu-latest
    outputs:
      should_deploy: ${{ steps.check.outputs.should_deploy }}
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      
      - name: Check if tag is on main or master branch
        id: check
        run: |
          git fetch origin main master || true
          BRANCHES=$(git branch -r --contains ${{ github.ref }})
          
          if echo "$BRANCHES" | grep -qE 'origin/(main|master)'; then
            echo "✓ Tag is on main or master branch"
            echo "should_deploy=true" >> $GITHUB_OUTPUT
          else
            echo "✗ Tag is not on main or master branch, skipping deployment"
            echo "Tag is on: $BRANCHES"
            echo "should_deploy=false" >> $GITHUB_OUTPUT
          fi
      
      - name: Verify version consistency
        if: steps.check.outputs.should_deploy == 'true'
        run: |
          # Extract version from git tag (remove 'v' prefix)
          TAG_VERSION="${{ github.ref_name }}"
          TAG_VERSION="${TAG_VERSION#v}"
          # Extract version from Cargo.toml
          CARGO_VERSION=$(grep -m1 '^version' Cargo.toml | sed 's/.*"\(.*\)"/\1/')
          echo "Git tag version: $TAG_VERSION"
          echo "Cargo.toml version: $CARGO_VERSION"
          if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then
            echo "ERROR: Version mismatch! Tag version ($TAG_VERSION) != Cargo.toml version ($CARGO_VERSION)"
            exit 1
          fi
          echo "✓ Version check passed!"

  check:
    uses: ./.github/workflows/check.yml
    needs: verify-tag
    if: needs.verify-tag.outputs.should_deploy == 'true'

  test:
    uses: ./.github/workflows/test.yml
    needs: verify-tag
    if: needs.verify-tag.outputs.should_deploy == 'true'

  build:
    name: Build documentation
    runs-on: ubuntu-latest
    needs: [verify-tag, check, test]
    if: needs.verify-tag.outputs.should_deploy == 'true'
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@nightly

      - name: Build docs
        env:
          RUSTDOCFLAGS: -D rustdoc::broken_intra_doc_links -D missing-docs
        run: |
          cargo doc --no-deps --all-features
          printf '<meta http-equiv="refresh" content="0;url=%s/index.html">' $(cargo tree | head -1 | cut -d' ' -f1) > target/doc/index.html

      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: target/doc

  deploy:
    name: Deploy to GitHub Pages
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    needs: [verify-tag, build]
    if: needs.verify-tag.outputs.should_deploy == 'true'
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4