ci: change permissions to write #83
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/**/* | |
# TODO previously would manually tag, | |
# tags: | |
# - v* # Push events to matching v*, i.e. v1.0, v20.15.10 | |
# by default, permissions are read-only, read + write is required for git pushes | |
permissions: | |
contents: write | |
jobs: | |
build: | |
# TODO switch to macos-latest once that represents > 13 | |
runs-on: macos-13 | |
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: | | |
ls /Applications | |
sudo xcode-select -s /Applications/Xcode_14.2.app | |
- name: Test | |
run: swift test -vv | |
- name: Conventional Changelog Action | |
id: changelog | |
uses: TriPSs/conventional-changelog-action@v4 | |
with: | |
github-token: ${{ secrets.GH_PERSONAL_TOKEN }} | |
skip-version-file: "true" | |
pre-commit: bin/pre-commit.js | |
- 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: | |
token: ${{secrets.GH_PERSONAL_TOKEN}} | |
tap: iloveitaly/homebrew-tap | |
livecheck: true |