Skip to content

chore(main): release 4.0.3 #177

chore(main): release 4.0.3

chore(main): release 4.0.3 #177

Workflow file for this run

name: build
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
macos_big_sur:
runs-on: macos-11
strategy:
matrix:
xcode:
- '12.5'
name: macOS Big Sur (Xcode ${{ matrix.xcode }})
steps:
- name: checkout
uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: .build
key: ${{ runner.os }}-xcode-${{ matrix.xcode }}-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-xcode-${{ matrix.xcode }}
- name: build
run: |
ls -n /Applications/ | grep Xcode*
make build
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
- name: test
run: |
swift test
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
macos_arm64:
runs-on: [self-hosted, macOS, X64]
name: macOS Big Sur arm64
steps:
- name: checkout
uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: .build
key: ${{ runner.os }}-xcode-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-xcode
- name: build
run: |
make build
env:
DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer
- name: test
run: |
swift test
env:
DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer
create_release:
needs:
- macos_big_sur
- macos_arm64
runs-on: macos-11
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_big_sur:
needs:
- create_release
runs-on: macos-11
if: ${{ needs.create_release.outputs.release_created }}
name: Create bottle Big Sur
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
create_bottle_big_sur_arm64:
needs:
- create_release
runs-on: [self-hosted, macOS, X64]
if: ${{ needs.create_release.outputs.release_created }}
name: Create bottle Big Sur (arm64)
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 }}
arch -arm64 ./scripts/bottle.sh ${{ needs.create_release.outputs.tag_name }} arm64_big_sur
- name: Upload bottle
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_big_sur
- create_bottle_big_sur_arm64
runs-on: macos-11
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_big_sur.outputs.root_url }}' | sed 's/\\//\\\\\//g'`
sha_big_sur='${{ needs.create_bottle_big_sur.outputs.sha }}'
sha_big_sur_arm64='${{ needs.create_bottle_big_sur_arm64.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, arm64_big_sur: \"[^\"]+\"/sha256 cellar: :any_skip_relocation, arm64_big_sur: \"$sha_big_sur_arm64\"/g" $formula
sed -E -i "" "s/sha256 cellar: :any_skip_relocation, big_sur: \"[^\"]+\"/sha256 cellar: :any_skip_relocation, big_sur: \"$sha_big_sur\"/g" $formula
git commit -am "chore: update sendkeys to ${{ needs.create_release.outputs.tag_name }}"
git push origin main