Enhance GitHub Actions workflow by adding write permissions for discu… #14
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: | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
contents: write | |
discussions: write | |
jobs: | |
build: | |
name: Build and Release | |
runs-on: macos-14 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Xcode | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '16.1' | |
- name: Install Tuist | |
run: | | |
brew install tuist | |
- 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 -arch x86_64 \ | |
clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | |
- name: Create DMG | |
run: | | |
brew install create-dmg | |
create-dmg \ | |
--volname "TypeSwitch" \ | |
--window-size 500 300 \ | |
--app-drop-link 350 150 \ | |
"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 | |
if: startsWith(github.ref, 'refs/tags/v') | |
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') }} | |
generate_release_notes: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |