Make monitored apps scrollable #539
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: Release | |
on: | |
pull_request: | |
types: [opened, reopened, ready_for_review, synchronize] | |
push: | |
branches: [main, release] | |
tags-ignore: "**" | |
jobs: | |
test: | |
name: Tests and Build | |
runs-on: macos-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Install xcodegen via Homebrew for linting and building xcode project | |
run: brew install xcodegen | |
- | |
name: Generate project | |
run: xcodegen | |
- | |
name: Build app to run linters | |
run: xcodebuild -scheme WakaTime | |
version: | |
name: Version | |
concurrency: tagging | |
if: ${{ github.ref == 'refs/heads/release' || github.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
needs: [test] | |
outputs: | |
semver: ${{ steps.format.outputs.semver }} | |
semver_tag: ${{ steps.semver-tag.outputs.semver_tag }} | |
ancestor_tag: ${{ steps.semver-tag.outputs.ancestor_tag }} | |
is_prerelease: ${{ steps.semver-tag.outputs.is_prerelease }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- | |
name: Calculate semver tag | |
id: semver-tag | |
uses: wakatime/semver-action@master | |
with: | |
prefix: v | |
prerelease_id: alpha | |
develop_branch_name: main | |
main_branch_name: release | |
- | |
name: Format | |
id: format | |
run: | | |
echo "${{ steps.semver-tag.outputs.semver_tag }}" | |
ver=`echo "${{ steps.semver-tag.outputs.semver_tag }}" | sed 's/^v//'` | |
echo "$ver" | |
echo "semver=$ver" >> $GITHUB_OUTPUT | |
- | |
name: Create tag | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "refs/tags/${{ steps.semver-tag.outputs.semver_tag }}", | |
sha: context.sha | |
}) | |
sign: | |
name: Sign Apple app | |
needs: [version] | |
runs-on: macos-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Update project.yml | |
uses: fjogeleit/yaml-update-action@main | |
with: | |
valueFile: 'project.yml' | |
changes: | | |
{ | |
"targets.WakaTime.settings.CURRENT_PROJECT_VERSION": "${{ needs.version.outputs.semver }}", | |
"targets.WakaTime.settings.MARKETING_VERSION": "${{ needs.version.outputs.semver }}" | |
} | |
commitChange: false | |
- | |
name: Install xcodegen via Homebrew for linting and building xcode project | |
run: brew install xcodegen | |
- | |
name: Generate project | |
run: xcodegen | |
- | |
name: Build app | |
id: build | |
run: | | |
xcodebuild -scheme WakaTime -configuration Release | |
app=`find /Users/runner/Library/Developer/Xcode/DerivedData/ -name WakaTime.app` | |
echo "$app" | |
directory=`dirname $app` | |
echo "$directory" | |
echo "directory=$directory" >> $GITHUB_OUTPUT | |
- | |
name: Import Code-Signing Certificates | |
uses: Apple-Actions/import-codesign-certs@v1 | |
with: | |
# The certificates in a PKCS12 file encoded as a base64 string | |
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }} | |
# The password used to import the PKCS12 file. | |
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }} | |
- | |
name: Codesign | |
run: | | |
codesign -v --force --deep --timestamp -s "WakaTime" --options runtime ${{ steps.build.outputs.directory }}/WakaTime.app | |
- | |
name: Store Credentials | |
env: | |
NOTARIZATION_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
NOTARIZATION_APPLE_ID: ${{ secrets.AC_USERNAME }} | |
NOTARIZATION_PWD: ${{ secrets.AC_PASSWORD }} | |
run: xcrun notarytool store-credentials "notarytool-profile" --apple-id "$NOTARIZATION_APPLE_ID" --team-id "$NOTARIZATION_TEAM_ID" --password "$NOTARIZATION_PWD" | |
- | |
name: Notarize Helper | |
run: | | |
ditto -c -k --keepParent "${{ steps.build.outputs.directory }}/WakaTime.app/Contents/Library/LoginItems/WakaTime Helper.app" helper.zip | |
xcrun notarytool submit helper.zip --keychain-profile "notarytool-profile" --wait | |
xcrun stapler staple "${{ steps.build.outputs.directory }}/WakaTime.app/Contents/Library/LoginItems/WakaTime Helper.app" | |
- | |
name: Notarize App | |
run: | | |
ditto -c -k --keepParent ${{ steps.build.outputs.directory }}/WakaTime.app main.zip | |
xcrun notarytool submit main.zip --keychain-profile "notarytool-profile" --wait | |
xcrun stapler staple ${{ steps.build.outputs.directory }}/WakaTime.app | |
- | |
name: Zip | |
run: ditto -c -k --sequesterRsrc --keepParent ${{ steps.build.outputs.directory }}/WakaTime.app WakaTime.zip | |
- | |
name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: app | |
path: ./WakaTime.zip | |
- | |
name: Remove tag if failure | |
if: ${{ failure() }} | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
github.rest.git.deleteRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "tags/${{ needs.version.outputs.semver_tag }}" | |
}) | |
changelog: | |
name: Changelog | |
runs-on: ubuntu-latest | |
needs: [version, sign] | |
outputs: | |
changelog: ${{ steps.changelog.outputs.changelog }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- | |
if: ${{ github.ref == 'refs/heads/main' }} | |
name: Changelog for main | |
uses: gandarez/[email protected] | |
id: changelog-main | |
with: | |
current_tag: ${{ github.sha }} | |
previous_tag: ${{ needs.version.outputs.ancestor_tag }} | |
exclude: | | |
^Merge pull request .* | |
- | |
if: ${{ github.ref == 'refs/heads/release' }} | |
name: Get related pull request | |
uses: 8BitJonny/[email protected] | |
id: changelog-release | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Prepare changelog | |
id: changelog | |
run: | | |
echo "${{ steps.changelog-main.outputs.changelog || steps.changelog-release.outputs.pr_body }}" > changelog.txt | |
./bin/prepare_changelog.sh $(echo ${GITHUB_REF#refs/heads/}) "$(cat changelog.txt)" | |
- | |
name: Remove tag if failure | |
if: ${{ failure() }} | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
github.rest.git.deleteRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "tags/${{ needs.version.outputs.semver_tag }}" | |
}) | |
release: | |
name: Release | |
runs-on: macos-latest | |
needs: [version, sign, changelog] | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- | |
name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: app | |
path: ./ | |
- | |
name: Prepare release folder | |
id: prepare | |
run: | | |
mkdir release | |
mv ./WakaTime.zip release/macos-wakatime.zip | |
- | |
name: "Create release" | |
uses: softprops/action-gh-release@master | |
with: | |
name: ${{ needs.version.outputs.semver_tag }} | |
tag_name: ${{ needs.version.outputs.semver_tag }} | |
body: "## Changelog\n${{ needs.changelog.outputs.changelog }}" | |
prerelease: ${{ needs.version.outputs.is_prerelease }} | |
target_commitish: ${{ github.sha }} | |
draft: false | |
files: | | |
./release/macos-wakatime.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Remove tag if failure | |
if: ${{ failure() }} | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
github.rest.git.deleteRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "tags/${{ needs.version.outputs.semver_tag }}" | |
}) |