Create a Release #109
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: Create a Release | |
on: | |
workflow_dispatch: | |
inputs: | |
major: | |
description: "Major" | |
type: boolean | |
default: false | |
minor: | |
description: "Minor" | |
type: boolean | |
default: false | |
jobs: | |
determine_version: | |
name: Determine the next build version | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.echo_version.outputs.version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install dependencies | |
run: npm ci | |
working-directory: ./.github/release | |
- if: ${{ inputs.major == true }} | |
id: determine_version_major | |
name: Get Version - MAJOR | |
run: npm run release -- major --ci --release-version | tail -n 1 > RELEASE_VERSION | |
working-directory: ./.github/release | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }} | |
- if: ${{inputs.major == false && inputs.minor == true}} | |
id: determine_version_minor | |
name: Get Version - MINOR | |
run: npm run release -- minor --ci --release-version | tail -n 1 > RELEASE_VERSION | |
working-directory: ./.github/release | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }} | |
- if: ${{ inputs.major == false && inputs.minor == false }} | |
id: determine_version_patch | |
name: Get Version - PATCH | |
run: npm run release -- --ci --release-version | tail -n 1 > RELEASE_VERSION | |
working-directory: ./.github/release | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }} | |
- id: echo_version | |
run: echo "::set-output name=version::$(cat ./.github/release/RELEASE_VERSION)" | |
build_framework: | |
name: Create RiveRuntime.xcframework | |
runs-on: ghcr.io/cirruslabs/macos-runner:sonoma | |
needs: [determine_version] | |
outputs: | |
checksum: ${{steps.get_checksum.outputs.checksum}} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
token: ${{ secrets.PAT_GITHUB }} | |
- name: Configure venv | |
run: | | |
python3 -m venv .venv | |
source .venv/bin/activate | |
echo PATH=$PATH >> $GITHUB_ENV | |
- name: Installing pre-requisites | |
run: | | |
set -x | |
# Install some dependencies & premake5 | |
brew install ninja | |
curl https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-macosx.tar.gz -L -o premake_macosx.tar.gz | |
tar -xvf premake_macosx.tar.gz 2>/dev/null | |
rm premake_macosx.tar.gz | |
mkdir bin | |
sudo chmod a+x premake5 | |
cp premake5 bin/premake5 | |
sudo mv premake5 /usr/local/bin | |
pip3 install ply | |
- name: Select Xcode 15.4 | |
run: sudo xcodes select 15.4 | |
- name: Build everything (using the cache, we should make an archive of course) | |
run: ./scripts/build.sh all | |
- name: Update Marketing versions | |
run: agvtool new-marketing-version ${{ needs.determine_version.outputs.version }} | |
- name: Upload versionFiles | |
uses: actions/upload-artifact@v4 | |
with: | |
name: version-files | |
path: | | |
RiveRuntime.xcodeproj/project.pbxproj | |
Source/Info.plist | |
Tests/Info.plist | |
- id: build_frameworks | |
name: Build frameworks | |
run: sh ./scripts/build_framework.sh -c Release | |
- id: zip | |
name: Zip the framework | |
# --symlinks is critical here to retain the structure of a macos framework. | |
run: zip --symlinks -r RiveRuntime.xcframework.zip RiveRuntime.xcframework | |
working-directory: ./archive | |
- id: get_checksum | |
name: Add the checksum of the zip file into our environment | |
run: echo "::set-output name=checksum::$(swift package compute-checksum archive/RiveRuntime.xcframework.zip)" | |
- name: Upload xcFramework | |
uses: actions/upload-artifact@v4 | |
with: | |
name: RiveRuntime.xcframework.zip | |
path: archive/RiveRuntime.xcframework.zip | |
do_release: | |
name: Do the actual release | |
runs-on: ubuntu-latest | |
needs: [determine_version, build_framework] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: npm ci | |
working-directory: ./.github/release | |
- id: read_package_template | |
uses: pCYSl5EDgo/cat@master | |
with: | |
path: .github/workflows/Package.swift.template | |
- name: Create Package.swift | |
run: | | |
cat > Package.swift <<-EOF | |
${{ steps.read_package_template.outputs.text }} | |
EOF | |
env: | |
CHECKSUM: ${{ needs.build_framework.outputs.checksum }} | |
RELEASE_VERSION: ${{ needs.determine_version.outputs.version }} | |
- id: read_podspec_template | |
uses: pCYSl5EDgo/cat@master | |
with: | |
path: .github/workflows/RiveRuntime.podspec.template | |
- name: Create RiveRuntime.podspec | |
run: | | |
cat > RiveRuntime.podspec <<-EOF | |
${{ steps.read_podspec_template.outputs.text }} | |
EOF | |
env: | |
RELEASE_VERSION: ${{ needs.determine_version.outputs.version }} | |
- name: Upload podspec file | |
uses: actions/upload-artifact@v4 | |
with: | |
name: RiveRuntime.podspec | |
path: RiveRuntime.podspec | |
- name: Upload PrivacyInfo file | |
uses: actions/upload-artifact@v4 | |
with: | |
name: PrivacyInfo.xcprivacy | |
path: Resources/ | |
- name: Git config | |
run: | | |
git config --local user.email '[email protected]' | |
git config --local user.name ${{ github.actor }} | |
- name: Download versionFiles | |
uses: actions/download-artifact@v4 | |
with: | |
name: version-files | |
- name: Add & commit version files (might want to look into doing this in release-it) | |
run: git add RiveRuntime.podspec Package.swift Source/Info.plist Tests/Info.plist && git commit -m "Updating version files" | |
- name: Download framework artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: RiveRuntime.xcframework.zip | |
path: archive/ | |
- if: ${{ inputs.major == true }} | |
name: Major Release - Bump version number, update changelog, push and tag | |
run: npm run release -- major --ci | |
working-directory: ./.github/release | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }} | |
- if: ${{inputs.major == false && inputs.minor == true}} | |
name: Minor release - Bump version number, update changelog, push and tag | |
run: npm run release -- minor --ci | |
working-directory: ./.github/release | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }} | |
- if: ${{inputs.major == false && inputs.minor == false}} | |
name: Build release - Bump version number, update changelog, push and tag | |
run: npm run release -- --ci | |
working-directory: ./.github/release | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }} | |
publish_cocoapods: | |
name: Publish framework to cocoapods | |
runs-on: macos-12 | |
needs: [determine_version, build_framework, do_release] | |
steps: | |
- name: Download framework artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: RiveRuntime.xcframework.zip | |
- name: Download podspec file | |
uses: actions/download-artifact@v4 | |
with: | |
name: RiveRuntime.podspec | |
- name: Download PrivacyInfo file | |
uses: actions/download-artifact@v4 | |
with: | |
name: PrivacyInfo.xcprivacy | |
path: Resources/ | |
- name: Extract archive to pass cocoapods validation | |
run: unzip RiveRuntime.xcframework.zip | |
- name: Publish pod to the CocoaPods | |
uses: michaelhenry/[email protected] | |
env: | |
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} |