Build and Release Workflow #20
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: Build and Release | |
on: | |
pull_request: | |
branches: | |
- alpha #change to production after testing | |
#ypes: [closed] ##TODO: Remove after testing | |
jobs: | |
build_and_release: | |
runs-on: macos-13 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Xcode | |
uses: maxim-lobanov/[email protected] | |
with: | |
xcode-version: '15.0.1' | |
- name: Extract Version and Build Number | |
id: extract_version_build_number | |
run: | | |
version=$(grep -m 1 -o 'MARKETING_VERSION\s*=\s*[^;]*' winston.xcodeproj/project.pbxproj | sed 's/MARKETING_VERSION = //') | |
build_number=$(grep -m 1 -o 'CURRENT_PROJECT_VERSION\s*=\s*[^;]*' winston.xcodeproj/project.pbxproj | sed 's/CURRENT_PROJECT_VERSION = //') | |
if [ -z "$version" ]; then | |
echo "Version not set" | |
version="" | |
fi | |
if [ -z "$build_number" ]; then | |
build_number="-$build_number" | |
fi | |
if [ -z "$build_number" ]; then | |
echo "Build Number not set" | |
build_number="" | |
fi | |
if [ -z "$build_number" ]; then | |
build_number="-$buid_number" | |
fi | |
#TODO: Does this work? | |
echo "::set-output name=version::$version" | |
echo "::set-output name=build_number::$build_number" | |
- name: Read release body from whattotest file | |
id: read_file | |
# For some reason this works only with the deprecated output syntax | |
run: | | |
release_body=$(cat TestFlight/WhatToTest.en-US.txt) | |
echo "::set-output name=release_body::$release_body" | |
- name: Decode apple-key-content | |
env: | |
APPLE_KEY_CONTENT_B64: ${{ secrets.APPLE_KEY_CONTENT_B64 }} | |
run: base64 -D -i $APPLE_KEY_CONTENT_B64 > apple_key.p8 | |
- name: Build and Archive App | |
uses: sparkfabrik/[email protected] | |
with: | |
apple-key-id: ${{ secrets.APPLE_KEY_ID }} | |
apple-key-issuer-id: ${{ secrets.APPLE_KEY_ISSUER_ID }} | |
apple-key-content: apple_key.p8 | |
project-path: winston.xcodeproj | |
export-method: package | |
match-build-type: appstore | |
scheme: winston | |
output-path: $PWD/build/Winston.ipa | |
team-id: Z2NNLU4F7U | |
team-name: "lo.cafe" | |
ios-app-id: lo.cafe.winston | |
upload-to-testflight: false | |
increment-build-number: false | |
- name: Upload Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: $PWD/build/Winston.ipa | |
tag_name: Winston-v-${{ steps.extract_version_build_number.outputs.version }}${{ steps.extract_version_build_number.outputs.build_number }} | |
name: "Winston-v-${{ steps.extract_version_build_number.outputs.version }}${{ steps.extract_version_build_number.outputs.build_number }}" | |
body: ${{ steps.read_file.outputs.release_body }} |