style: trunk fix #93
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 & Release | |
on: | |
# allow manual runs for debugging purposes | |
workflow_dispatch: {} | |
push: | |
branches: | |
- main | |
paths: | |
- Sources/**/* | |
- Package.* | |
- .github/**/* | |
permissions: | |
contents: read | |
jobs: | |
build: | |
# TODO switch to macos-latest once that represents > 13 | |
runs-on: macos-13 | |
env: | |
# https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow | |
# https://stackoverflow.com/questions/60418323/triggering-a-new-workflow-from-another-workflow/60418414#60418414 | |
GITHUB_TOKEN: ${{ secrets.GH_PERSONAL_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Trunk Check | |
uses: trunk-io/trunk-action@v1 | |
with: | |
# without check-mode, only the diff is checked, but there is no delta | |
# when running within the context of a tag push | |
check-mode: all | |
# TODO is there a way to set swift version explicitly? | |
- name: setup Xcode version | |
run: | | |
# output list of xcode app versions to easily update the selected version | |
ls /Applications | |
sudo xcode-select -s /Applications/Xcode_15.1.0.app | |
- name: Test | |
run: swift test -vv | |
- name: Conventional Changelog Action | |
id: changelog | |
uses: TriPSs/conventional-changelog-action@v5 | |
with: | |
skip-version-file: "true" | |
pre-commit: bin/pre-commit.js | |
# NOTE if not provided, GITHUB_TOKEN is *not* used! | |
# https://github.com/TriPSs/conventional-changelog-action/blob/66cc91f84686286f21478f1f781ea8b34bdf0446/action.yml#L16 | |
github-token: ${{ secrets.GH_PERSONAL_TOKEN }} | |
- name: Build Release Binary | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
run: swift build -v -c release --arch arm64 --arch x86_64 | |
- name: Zip Release Binary | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
run: zip -rj hyper-focus.zip .build/apple/Products/Release/hyper-focus | |
- name: Release | |
if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: hyper-focus.zip | |
# output options: https://github.com/TriPSs/conventional-changelog-action#outputs | |
body: ${{ steps.changelog.outputs.clean_changelog }} | |
tag_name: ${{ steps.changelog.outputs.tag }} | |
- name: Update Homebrew formula | |
uses: dawidd6/action-homebrew-bump-formula@v3 | |
with: | |
tap: iloveitaly/homebrew-tap | |
livecheck: true |