Prepare main
to Release 1.0.0
#2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release and Publish | |
on: | |
pull_request: | |
types: [closed] | |
branches: | |
- 'main' | |
jobs: | |
post-merge: | |
if: contains(github.event.pull_request.labels.*.name, 'release') | |
runs-on: macos-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up Cocoapods | |
run: gem install cocoapods | |
- name: Get new version | |
id: version | |
run: echo "VERSION=$(ruby -e 'puts File.read("./OSInAppBrowserLib.podspec").match(/spec.version.*=.*''(\d+\.\d+\.\d+)''/)[1]')" >> $GITHUB_ENV | |
- name: Extract release notes | |
run: sh scripts/extract_release_notes.sh "${{ env.VERSION }}" >> release_notes.md | |
- name: Create Tag | |
id: create_tag | |
run: | | |
# Define the tag name and message | |
TAG_NAME="${{ env.VERSION }}" | |
TAG_MESSAGE="Tag for version ${{ env.VERSION }}" | |
# Create the tag | |
git tag -a "$TAG_NAME" -m "$TAG_MESSAGE" | |
git push origin "$TAG_NAME" | |
echo "Tag created: $TAG_NAME" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
run: | | |
# Extract the tag name | |
TAG_NAME="${{ env.VERSION }}" | |
RELEASE_NOTES="$(cat release_notes.md)" | |
# Create the release using GitHub CLI | |
gh release create "$TAG_NAME" \ | |
--title "$TAG_NAME" \ | |
--notes "$RELEASE_NOTES" \ | |
"OSInAppBrowserLib.zip" | |
echo "Release created for tag: $TAG_NAME" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Deploy to Cocoapods | |
run: pod trunk push ./OSInAppBrowserLib.podspec --allow-warnings | |
env: | |
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} | |
- name: Delete Release Branch | |
run: git push origin --delete prepare-new-release-${{ env.VERSION }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |