Skip to content

Commit

Permalink
Merge pull request #479 from EvanNotFound/dev
Browse files Browse the repository at this point in the history
ci: improve release workflow robustness and error handling
  • Loading branch information
EvanNotFound authored Dec 2, 2024
2 parents 13ba3e8 + 33bc19f commit 3857f60
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
run: |
VERSION=$(node -p "require('./package.json').version")
BRANCH="release/v${VERSION}"
git checkout -b $BRANCH
git checkout -b $BRANCH || git checkout $BRANCH
npm run release:${{ github.event.inputs.release-type }}
- name: Update package-lock.json
Expand All @@ -61,30 +61,30 @@ jobs:
- name: Commit Changes
run: |
NEW_VERSION=$(node -p "require('./package.json').version")
git add package.json package-lock.json
git commit -m "chore: bump version to ${NEW_VERSION}"
git push -u origin $BRANCH
if ! git diff --quiet; then
git add package.json package-lock.json
git commit -m "chore: bump version to ${NEW_VERSION}"
git push -u origin $BRANCH
else
echo "No changes to commit"
exit 1
fi
- name: Create Pull Request
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
NEW_VERSION=$(node -p "require('./package.json').version")
gh pr create --base main --head "release/v${NEW_VERSION}" --title "Release v${NEW_VERSION}" --body "Automated release PR for version ${NEW_VERSION}"
gh pr create --base main --head "release/v${NEW_VERSION}" --title "Release v${NEW_VERSION}" --body "Automated release PR for version ${NEW_VERSION}" || echo "PR already exists"
- name: Create GitHub Release (Draft)
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
NEW_VERSION=$(node -p "require('./package.json').version")
gh release create "v${NEW_VERSION}" \
--draft \
--title "v${NEW_VERSION}" \
--notes "Release v${NEW_VERSION}"
- name: Update dev branch
run: |
NEW_VERSION=$(node -p "require('./package.json').version")
git checkout dev
git merge "release/v${NEW_VERSION}"
git push origin dev
--notes "Release v${NEW_VERSION}" || echo "Release already exists"

0 comments on commit 3857f60

Please sign in to comment.