Skip to content

Commit

Permalink
add back release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
alanhamlett committed Jun 13, 2023
1 parent 554a8af commit 9facfa5
Showing 1 changed file with 161 additions and 23 deletions.
184 changes: 161 additions & 23 deletions .github/workflows/on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,77 @@ 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

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:
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:
-
Expand All @@ -18,7 +85,7 @@ jobs:
with:
valueFile: 'project.yml'
propertyPath: 'targets.WakaTime.settings.MARKETING_VERSION'
value: '1.2.3'
value: ${{ needs.version.outputs.semver }}
commitChange: false
-
name: Install xcodegen via Homebrew for linting and building xcode project
Expand All @@ -38,17 +105,17 @@ jobs:
# The password used to import the PKCS12 file.
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
-
name: Codesign WakaTime Helper.app
name: Codesign Helper
run: |
/usr/bin/codesign --force -s "WakaTime" --options runtime "build/Release/WakaTime.app/Contents/Library/LoginItems/WakaTime Helper.app" -v
/usr/bin/codesign --verify --deep --strict --verbose=2 "build/Release/WakaTime.app/Contents/Library/LoginItems/WakaTime Helper.app"
-
name: Codesign libswift_Concurrency.dylib
run: |
/usr/bin/codesign --force -s "WakaTime" --options runtime "build/Release/WakaTime.app/Contents/Frameworks/libswift_Concurrency.dylib" -v
/usr/bin/codesign --verify --deep --strict --verbose=2 "build/Release/WakaTime.app/Contents/Frameworks/libswift_Concurrency.dylib"
/usr/bin/codesign --force -s "WakaTime" --options runtime build/Release/WakaTime.app/Contents/Frameworks/libswift_Concurrency.dylib -v
/usr/bin/codesign --verify --deep --strict --verbose=2 build/Release/WakaTime.app/Contents/Frameworks/libswift_Concurrency.dylib
-
name: Codesign WakaTime.app
name: Codesign App
run: |
/usr/bin/codesign --force -s "WakaTime" --options runtime build/Release/WakaTime.app -v
/usr/bin/codesign --verify --deep --strict --verbose=2 build/Release/WakaTime.app
Expand All @@ -60,30 +127,22 @@ jobs:
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 WakaTime Helper.app
name: Notarize Helper
run: |
ditto -c -k --keepParent "build/Release/WakaTime.app/Contents/Library/LoginItems/WakaTime Helper.app" helper.zip
xcrun notarytool submit helper.zip --keychain-profile "notarytool-profile" --wait
xcrun stapler staple "build/Release/WakaTime.app/Contents/Library/LoginItems/WakaTime Helper.app"
#-
# name: Notarize libswift_Concurrency.dylib
# run: |
# ditto -c -k --keepParent "build/Release/WakaTime.app/Contents/Frameworks/libswift_Concurrency.dylib" concurrency.zip
# xcrun notarytool submit concurrency.zip --keychain-profile "notarytool-profile" --wait
# xcrun stapler staple "build/Release/WakaTime.app/Contents/Frameworks/libswift_Concurrency.dylib"
-
name: Notarize WakaTime.app
-
name: Notarize libswift_Concurrency.dylib
run: |
ditto -c -k --keepParent build/Release/WakaTime.app main.zip
UUID=$(xcrun notarytool submit main.zip --keychain-profile "notarytool-profile" --wait | grep -m 1 -o '[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}')
#echo $UUID
#xcrun notarytool history --keychain-profile "notarytool-profile"
#xcrun notarytool log $UUID --keychain-profile "notarytool-profile"
#xcrun notarytool log 1b0112d7-1b83-414b-82a0-0e376d1d81bd --keychain-profile "notarytool-profile"
sleep 300
-
name: Staple WakaTime.app
ditto -c -k --keepParent build/Release/WakaTime.app/Contents/Frameworks/libswift_Concurrency.dylib concurrency.zip
xcrun notarytool submit concurrency.zip --keychain-profile "notarytool-profile" --wait
xcrun stapler staple build/Release/WakaTime.app/Contents/Frameworks/libswift_Concurrency.dylib
-
name: Notarize App
run: |
ditto -c -k --keepParent build/Release/WakaTime.app main.zip
xcrun notarytool submit main.zip --keychain-profile "notarytool-profile" --wait
xcrun stapler staple build/Release/WakaTime.app
-
name: Zip
Expand All @@ -94,3 +153,82 @@ jobs:
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 }}"
})
release:
name: Release
runs-on: ubuntu-latest
needs: [version, sign]
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
# Run only for main branch
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 .*
-
# Run only for release branch
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: Download artifacts
uses: actions/download-artifact@v3
with:
name: app
path: ./
-
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${{ steps.changelog.outputs.changelog }}"
prerelease: ${{ needs.version.outputs.is_prerelease }}
target_commitish: ${{ github.sha }}
draft: false
files: ./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 }}"
})

0 comments on commit 9facfa5

Please sign in to comment.