diff --git a/.github/workflows/crates-version-bump.yml b/.github/workflows/crates-version-bump.yml index f2abd7c..c5bcfbf 100644 --- a/.github/workflows/crates-version-bump.yml +++ b/.github/workflows/crates-version-bump.yml @@ -2,20 +2,6 @@ name: Crates Version Bump on: workflow_dispatch: - inputs: - pre-id: - description: 'Prerelease identifier for prerelease versions' - required: false - default: 'alpha' - type: choice - options: - - beta - - rc - force: - description: 'Force version bump even if no changes detected' - required: false - default: false - type: boolean jobs: bump-version: @@ -43,17 +29,19 @@ jobs: git config --global user.email "github-actions[bot]@users.noreply.github.com" - name: Run version bump + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} run: | BRANCH="${GITHUB_REF_NAME}" - PRE_ID="${{ inputs.pre-id }}" - FORCE="${{ inputs.force }}" REPO_ROOT="$(git rev-parse --show-toplevel)" echo "Running on branch: $BRANCH" - echo "Prerelease identifier: $PRE_ID" $REPO_ROOT/scripts/bump-version.sh + echo "publishing on crates.io" + cargo release publish --workspace --execute + git push origin "$BRANCH" git push origin --tags diff --git a/.github/workflows/homebrew-update.yml b/.github/workflows/homebrew-update.yml new file mode 100644 index 0000000..f4be307 --- /dev/null +++ b/.github/workflows/homebrew-update.yml @@ -0,0 +1,58 @@ +name: Update Homebrew Formula + +on: + release: + types: [published] + workflow_dispatch: + inputs: + version: + description: 'Version to update to (e.g., 1.0.1)' + required: true + type: string + +jobs: + update-homebrew: + name: Update Homebrew Formula + runs-on: macos-latest + if: contains(github.event.release.tag_name, 'quickmark-cli@') || github.event_name == 'workflow_dispatch' + + steps: + - name: Extract version + id: version + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT + else + # Extract version from tag (quickmark-cli@1.0.0 -> 1.0.0) + version="${{ github.event.release.tag_name }}" + version="${version#quickmark-cli@}" + echo "version=$version" >> $GITHUB_OUTPUT + fi + + - name: Setup Homebrew + id: set-up-homebrew + uses: Homebrew/actions/setup-homebrew@master + + - name: Update Homebrew formula using bump-formula-pr + env: + HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Use brew bump-formula-pr to automatically update the formula + brew bump-formula-pr \ + --tap=ekropotin/homebrew-formula \ + --version="${{ steps.version.outputs.version }}" \ + --message="chore(brew): quickmark-cli ${{ steps.version.outputs.version }} + + Updates quickmark-cli to version ${{ steps.version.outputs.version }}. + + This PR was automatically created by the quickmark release workflow." \ + --no-browse \ + --no-fork \ + quickmark-cli || { + echo "Failed to create PR. Possible reasons:" + echo "1. The version is already up to date" + echo "2. The release assets are not yet available" + echo "3. There was a network issue" + echo "4. The formula doesn't exist or has issues" + exit 1 + } diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 418ad46..3338345 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -15,6 +15,9 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true - name: Setup Rust uses: dtolnay/rust-toolchain@stable @@ -34,9 +37,6 @@ jobs: with: tool: cargo-release,git-cliff - - name: Publish quickmark-cli to crates.io - run: cargo publish -p quickmark-cli --token ${{ secrets.CRATES_IO_TOKEN }} - - name: Generate changelog id: changelog run: | diff --git a/.github/workflows/release-core.yml b/.github/workflows/release-core.yml index 5f557ed..fbd0bfb 100644 --- a/.github/workflows/release-core.yml +++ b/.github/workflows/release-core.yml @@ -15,6 +15,9 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true - name: Setup Rust uses: dtolnay/rust-toolchain@stable @@ -34,9 +37,6 @@ jobs: with: tool: cargo-release,git-cliff - - name: Publish quickmark-core to crates.io - run: cargo publish -p quickmark-core --token ${{ secrets.CRATES_IO_TOKEN }} - - name: Generate changelog id: changelog run: | diff --git a/.github/workflows/release-server.yml b/.github/workflows/release-server.yml index 7ce5390..372cb48 100644 --- a/.github/workflows/release-server.yml +++ b/.github/workflows/release-server.yml @@ -32,6 +32,9 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true - name: Setup Rust uses: dtolnay/rust-toolchain@stable @@ -78,35 +81,9 @@ jobs: path: ${{ steps.binary-archive.outputs.archive_name }} if-no-files-found: error - publish: - name: Publish to crates.io - runs-on: ubuntu-latest - needs: build - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/quickmark-server@') - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Rust - uses: dtolnay/rust-toolchain@stable - - - name: Cache cargo registry - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo- - - - name: Publish quickmark-server to crates.io - run: cargo publish -p quickmark-server --token ${{ secrets.CRATES_IO_TOKEN }} - release: name: Create Release - needs: [build, publish] + needs: [build] runs-on: ubuntu-latest if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/quickmark-server@') permissions: diff --git a/release.toml b/release.toml index 6aa6ae3..c61a9e3 100644 --- a/release.toml +++ b/release.toml @@ -1,6 +1,3 @@ # pre-release-commit-message = "chore: Release {{crate_name}} version {{version}}" tag-name = "{{crate_name}}@{{version}}" -verify = false -push = false -publish = false consolidate-commits = true