Skip to content

Commit

Permalink
ci: fix publish step check before tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
ctran88 committed Jan 16, 2025
1 parent 7c19915 commit d13b0e0
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
workflow_call:
push:
branches:
- main
- fix-tagging-step-condition-check

permissions:
contents: write
Expand All @@ -15,30 +15,19 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
with:
token: ${{ secrets.BE_SDK_PAT }}
id: release
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
- uses: dtolnay/rust-toolchain@stable
if: ${{ steps.release.outputs.release_created }}
- uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
dry-run: true
check-repo: false
no-verify: true
id: publish-crates
# https://github.com/googleapis/release-please-action?tab=readme-ov-file#creating-majorminor-tags
- name: Tag versions
if: ${{ steps.release.outputs.release_created && fromJSON(steps.publish-crates.outputs.published).* }}
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/googleapis/release-please-action.git"
git tag -d v${{ steps.release.outputs.major }} || true
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
git push origin :v${{ steps.release.outputs.major }} || true
git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}"
git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}"
git push origin v${{ steps.release.outputs.major }}
git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}
echo "Tagging versions"
echo "published: ${{ steps.publish-crates.outputs.published }}"
echo "conclusion: ${{ steps.publish-crates.conclusion }}"
echo "outcome: ${{ steps.publish-crates.outcome }}"

0 comments on commit d13b0e0

Please sign in to comment.