Skip to content

Release

Release #4

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: "Version to release"
required: true
jobs:
release:
name: Release
runs-on: macOS-13
steps:
- name: Check out repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Xcode 14.3
run: sudo xcode-select -switch /Applications/Xcode_14.3.app
- name: Check for unreleased section in changelog
run: grep "## unreleased" CHANGELOG.md || (echo "::error::No unreleased section found in CHANGELOG"; exit 1)
- name: Set git username and email
run: |
git config user.name braintreeps
git config user.email code@getbraintree.com
- name: Update version
run: |
today=$(date +'%Y-%m-%d')
sed -i '' 's/## unreleased.*/## '"${{ github.event.inputs.version }}"' ('"$today"')/' CHANGELOG.md
sed -i '' 's/\(s\.version *= *\).*/\1"'"${{ github.event.inputs.version }}"'\"/' PopupBridge.podspec
plutil -replace CFBundleVersion -string ${{ github.event.inputs.version }} -- 'Demo/Demo/Info.plist'
plutil -replace CFBundleShortVersionString -string ${{ github.event.inputs.version }} -- 'Demo/Demo/Info.plist'
plutil -replace CFBundleVersion -string ${{ github.event.inputs.version }} -- 'Sources/PopupBridge/PopupBridge-Framework-Info.plist'
plutil -replace CFBundleShortVersionString -string ${{ github.event.inputs.version }} -- 'Sources/PopupBridge/PopupBridge-Framework-Info.plist'
git add .
git commit -m 'Bump version to ${{ github.event.inputs.version }}'
git tag ${{ github.event.inputs.version }} -a -m 'Release ${{ github.event.inputs.version }}'
- name: Push commits and tag
run: git push origin HEAD ${{ github.event.inputs.version }}
- name: Save changelog entries to a file
run: |
sed -e '1,/##/d' -e '/##/,$d' CHANGELOG.md > changelog_entries.md
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.version }}
release_name: ${{ github.event.inputs.version }}
body_path: changelog_entries.md
draft: false
prerelease: false
- name: Publish to CocoaPods
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: pod trunk push PopupBridge.podspec