Skip to content

Commit

Permalink
Fix Release Action. (#505)
Browse files Browse the repository at this point in the history
* Try to fetch latest commit in rollback

* Install VisionOS

* Change commit in rollback

* Fail on perpose

* Add pulling and logs

* Add creds for rallback

* Try to push

* Update version to 2.0.0-alpha.2

* Revert version update due to failed release

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
GLinnik21 and github-actions[bot] committed Jun 19, 2024
1 parent b88a8de commit c46279f
Showing 1 changed file with 51 additions and 4 deletions.
55 changes: 51 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ jobs:
- name: Install CocoaPods
run: gem install cocoapods

- name: Use Latest Stable Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Install visionOS Platform
shell: bash
run: |
# See https://github.com/actions/runner-images/issues/8144#issuecomment-1902072070
defaults write com.apple.dt.Xcode AllowUnsupportedVisionOSHost -bool YES
defaults write com.apple.CoreSimulator AllowUnsupportedVisionOSHost -bool YES
xcodebuild -downloadPlatform visionOS
- name: Update version in podspec
run: sed -i '' 's/s.version = "[^"]*"/s.version = "${{ github.event.inputs.version }}"/' KSCrash.podspec

Expand Down Expand Up @@ -58,15 +71,49 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Fetch all tags
run: |
echo "Fetching all tags..."
git fetch --tags
echo "Tags fetched successfully."
- name: Delete git tag locally
run: git tag -d ${{ github.event.inputs.version }}
run: |
echo "Attempting to delete local tag ${{ github.event.inputs.version }}..."
git tag -d ${{ github.event.inputs.version }} || echo "Tag not found locally"
echo "Local tag deletion process completed."
- name: Delete git tag remotely
run: git push --delete origin ${{ github.event.inputs.version }}
run: |
echo "Attempting to delete remote tag ${{ github.event.inputs.version }}..."
git push --delete origin ${{ github.event.inputs.version }} || echo "Tag not found on remote"
echo "Remote tag deletion process completed."
- name: Pull latest changes
run: |
echo "Pulling latest changes from release-action branch..."
git pull origin release-action
echo "Latest changes pulled successfully."
- name: Revert version commit
run: |
git revert --no-commit HEAD
echo "Identifying the last commit..."
previous_commit=$(git rev-list -n 1 HEAD)
echo "Last commit identified: $previous_commit"
echo "Attempting to revert commit $previous_commit..."
git revert --no-commit $previous_commit
echo "Revert command executed."
echo "Committing the revert with a message..."
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git commit -m "Revert version update due to failed release"
git push
echo "Revert commit completed."
- name: Push revert
run: |
echo "Pushing reverted changes to remote..."
git push || { echo "Push failed. Checking remote status..."; git status; exit 1; }
echo "Push completed."

0 comments on commit c46279f

Please sign in to comment.