feat: add argument to terminate execution #189
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 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: macos-14 | |
env: | |
DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer | |
name: Build | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: .build | |
key: ${{ runner.os }}-xcode-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-xcode- | |
- name: build | |
run: | | |
ls -n /Applications/ | grep Xcode* | |
make build | |
- name: test | |
run: | | |
./scripts/code-coverage.sh | |
create_release: | |
needs: | |
- build | |
runs-on: macos-14 | |
if: github.ref == 'refs/heads/main' | |
name: Create release | |
outputs: | |
release_created: ${{ steps.release.outputs.release_created }} | |
tag_name: ${{ steps.release.outputs.tag_name }} | |
sha: ${{ steps.release.outputs.sha }} | |
upload_url: ${{ steps.release.outputs.upload_url }} | |
steps: | |
- id: release | |
uses: google-github-actions/release-please-action@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release-type: simple | |
package-name: sendkeys | |
changelog-types: | | |
[ | |
{"type":"feat","section":"Features","hidden":false}, | |
{"type":"fix","section":"Bug Fixes","hidden":false}, | |
{"type":"docs","section":"Documentation","hidden":false}, | |
{"type":"misc","section":"Miscellaneous","hidden":false} | |
] | |
create_bottle: | |
needs: | |
- create_release | |
runs-on: macos-14 | |
if: ${{ needs.create_release.outputs.release_created }} | |
name: Create bottle | |
outputs: | |
file: ${{ steps.bottle.outputs.file }} | |
sha: ${{ steps.bottle.outputs.sha }} | |
root_url: ${{ steps.bottle.outputs.root_url }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: bottle | |
name: Create bottle | |
run: | | |
./scripts/update-version.sh ${{ needs.create_release.outputs.tag_name }} | |
./scripts/bottle.sh ${{ needs.create_release.outputs.tag_name }} big_sur | |
- name: Upload bottle | |
if: ${{ needs.create_release.outputs.release_created }} | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ./${{ steps.bottle.outputs.file }} | |
asset_name: ${{ steps.bottle.outputs.file }} | |
asset_content_type: application/gzip | |
homebrew: | |
needs: | |
- create_release | |
- create_bottle | |
runs-on: macos-14 | |
if: ${{ needs.create_release.outputs.release_created }} | |
name: Update homebrew formula | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Update homebrew formula | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email socsieng-github-actions[bot]@users.noreply.github.com | |
git clone "https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/socsieng/homebrew-tap.git" | |
cd homebrew-tap | |
git checkout -B main | |
formula='Formula/sendkeys.rb' | |
version=`echo '${{ needs.create_release.outputs.tag_name }}' | sed -E 's/^v//g'` | |
revision='${{ needs.create_release.outputs.sha }}' | |
sed_root_url=`echo '${{ needs.create_bottle.outputs.root_url }}' | sed 's/\\//\\\\\//g'` | |
sha='${{ needs.create_bottle.outputs.sha }}' | |
sed -E -i "" "s/tag: \"[^\"]+\"/tag: \"v$version\"/g" $formula | |
sed -E -i "" "s/revision: \"[^\"]+\"/revision: \"$revision\"/g" $formula | |
sed -E -i "" "s/version \"[^\"]+\"/version \"$version\"/g" $formula | |
sed -E -i "" "s/root_url \"[^\"]+\"/root_url \"$sed_root_url\"/g" $formula | |
sed -E -i "" "s/sha256 cellar: :any_skip_relocation, big_sur: \"[^\"]+\"/sha256 cellar: :any_skip_relocation, big_sur: \"$sha\"/g" $formula | |
git commit -am "chore: update sendkeys to ${{ needs.create_release.outputs.tag_name }}" | |
git push origin main |