Skip to content

Refactor GitHub Actions workflow for Tuist setup and build process #5

Refactor GitHub Actions workflow for Tuist setup and build process

Refactor GitHub Actions workflow for Tuist setup and build process #5

Workflow file for this run

name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build and Release
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.0'
- name: Setup mise
uses: jdx/mise-action@v2
- name: Install Tuist
run: |
mise install tuist@latest
mise use -g tuist@latest
- name: Clean Tuist Cache
run: |
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf ~/.tuist
rm -rf .tuist-bin
rm -rf Derived
rm -rf *.xcodeproj
rm -rf *.xcworkspace
- name: Setup Tuist
run: |
tuist install
tuist dependencies fetch
- name: Generate Xcode Project
run: |
tuist generate --no-open
- name: Build App
run: |
xcodebuild \
-workspace TypeSwitch.xcworkspace \
-scheme TypeSwitch \
-configuration Release \
-derivedDataPath ./DerivedData \
-arch arm64 \
clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
- name: Create DMG
run: |
brew install create-dmg
create-dmg \
--volname "TypeSwitch" \
--window-pos 200 120 \
--window-size 800 400 \
--icon-size 100 \
--icon "DerivedData/Build/Products/Release/TypeSwitch.app" 200 190 \
--hide-extension "TypeSwitch.app" \
--app-drop-link 600 185 \
"TypeSwitch.dmg" \
"DerivedData/Build/Products/Release/TypeSwitch.app"
- name: Create Source Archives
run: |
zip -r "TypeSwitch-${{ github.ref_name }}-src.zip" . \
-x "*.git*" -x "build/*" -x "*.xcodeproj/*" -x "*.xcworkspace/*" -x "*.dmg" -x "DerivedData/*"
- name: Generate Checksums
run: |
echo "### Checksums" > checksums.txt
echo "\`\`\`" >> checksums.txt
shasum -a 256 TypeSwitch.dmg "TypeSwitch-${{ github.ref_name }}-src.zip" >> checksums.txt
echo "\`\`\`" >> checksums.txt
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
TypeSwitch.dmg
TypeSwitch-${{ github.ref_name }}-src.zip
checksums.txt
body_path: checksums.txt
draft: false
prerelease: ${{ contains(github.ref, '-beta') || contains(github.ref, '-alpha') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}