v0.7.1 #2
Workflow file for this run
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
# Tested on MacOS with: | |
# act -s COMMITTER_TOKEN="$(gh auth token)" release --container-architecture linux/amd64 -P ubuntu-latest=catthehacker/ubuntu:act-latest -e <(echo '{ "release": { "tag_name": "v0.0.0" }}') | |
name: Update whisper-kit-expo | |
on: | |
release: | |
types: [released] | |
jobs: | |
update-whisperkit: | |
runs-on: ubuntu-latest | |
env: | |
TAG: ${{ github.event.release.tag_name }} | |
BRANCH_NAME: update-whisperkit-${{ github.event.release.tag_name }} | |
steps: | |
- name: Checkout whisper-kit-expo | |
uses: actions/checkout@v4 | |
with: | |
repository: seb-sep/whisper-kit-expo | |
fetch-depth: 0 | |
token: ${{ secrets.COMMITTER_TOKEN }} | |
ref: main | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: New branch | |
run: | | |
git checkout -b $BRANCH_NAME | |
echo ${{ github.event.release }} | |
echo "Release tag is $TAG" | |
- name: Update package.json version | |
run: | | |
PACKAGE_PATH="package.json" | |
# Check if the package.json exists at the specified path | |
if [ ! -f "$PACKAGE_PATH" ]; then | |
echo "Could not find package.json at path: $PACKAGE_PATH." | |
exit 1 | |
fi | |
# Normalize the release tag by removing a leading 'v', if present | |
RELEASE_TAG=${TAG#v} | |
# Update package.json with the new version | |
jq --arg newver "$RELEASE_TAG" '.whisperKit.version = $newver' "$PACKAGE_PATH" > tmp.$$.json && mv tmp.$$.json "$PACKAGE_PATH" | |
# Verify changes | |
cat "$PACKAGE_PATH" | |
- name: Commit changes | |
run: | | |
git config --global user.email "164233781+argmaxincbot@users.noreply.github.com" | |
git config --global user.name "argmaxincbot" | |
git add ./package.json | |
git commit -m "Update WhisperKit to $TAG" | |
git push origin $BRANCH_NAME | |
- name: Install and setup GitHub CLI if necessary | |
run: | | |
if ! command -v gh &> /dev/null | |
then | |
echo "GitHub CLI is not installed, installing..." | |
sudo apt update | |
sudo apt install -y gh | |
echo ${{ secrets.COMMITTER_TOKEN }} | gh auth login --with-token | |
else | |
echo "GitHub CLI is already installed" | |
fi | |
- name: PR with changes | |
run: | | |
gh pr create --title "Update WhisperKit to $TAG" --body "Update WhisperKit to $TAG" --base main --head $BRANCH_NAME | |