Skip to content

debug build #31

debug build

debug build #31

Workflow file for this run

name: build
on:
push:
branches:
- '**'
tags:
- "v*.*.*"
permissions:
actions: read
checks: read
contents: write
deployments: read
issues: read
discussions: read
packages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read
jobs:
build:
runs-on: macos-13
steps:
- uses: actions/checkout@v3
name: Checkout
- name: Install go
run: |
brew install go
GO_BINARY=$(which go)
echo "GO_BINARY=$GO_BINARY" >> .xcode.env.local
- name: Select Xcode
run: sudo xcode-select -s "/Applications/Xcode_15.1.app"
- name: Resolve dependencies
run: xcodebuild -resolvePackageDependencies
- name: Config environment
run: |
SCHEME=$(xcodebuild -list -json | jq -r '.project.schemes[0]')
BUILD_SETTINGS=$(xcodebuild -scheme "$SCHEME" -showBuildSettings -json | jq -r '.[0].buildSettings')
FULL_PRODUCT_NAME=$(echo $BUILD_SETTINGS | jq -r '.FULL_PRODUCT_NAME')
PRODUCT_NAME=$(echo $BUILD_SETTINGS | jq -r '.PRODUCT_NAME')
echo "SCHEME=$SCHEME" >> "$GITHUB_ENV"
echo "FULL_PRODUCT_NAME=$FULL_PRODUCT_NAME" >> "$GITHUB_ENV"
echo "PRODUCT_NAME=$PRODUCT_NAME" >> "$GITHUB_ENV"
- name: Install the Apple certificate
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
- name: Build
run: xcodebuild -scheme "$SCHEME" install DSTROOT=Build
- name: Package
run: |
npm install -g create-dmg
mkdir -p Build/dmg
create-dmg "Build/Applications/$FULL_PRODUCT_NAME" Build/dmg
mv Build/dmg/*.dmg Build/$PRODUCT_NAME.dmg
rm -r Build/dmg
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.PRODUCT_NAME }}.dmg
path: Build/${{ env.PRODUCT_NAME }}.dmg
- name: Prepare for release
if: startsWith(github.ref, 'refs/tags/')
run: |
set -e
VERSION=$(cat package.json | jq -r .version)
DMG_NAME="Build/${{ env.PRODUCT_NAME }}-v$VERSION.dmg"
CHANGELOG_PATH="$RUNNER_TEMP/CHANGELOG.md"
./scripts/changelog $VERSION > $CHANGELOG_PATH
cp Build/${{ env.PRODUCT_NAME }}.dmg $DMG_NAME
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
echo "DMG_NAME=$DMG_NAME" >> "$GITHUB_ENV"
echo "CHANGELOG_PATH=$CHANGELOG_PATH" >> "$GITHUB_ENV"
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: ${{ env.CHANGELOG_PATH }}
files: ${{ env.DMG_NAME }}
- name: Bump cask version
uses: benc-uk/workflow-dispatch@v1
if: startsWith(github.ref, 'refs/tags/')
with:
workflow: bump-cask.yaml
repo: softnetics/homebrew-tap
ref: main
inputs: '{ "cask": "dotlocal", "version": "${{ env.VERSION }}" }'