v0.9.0 #5
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 }} | |
GH_TOKEN: ${{ secrets.COMMITTER_TOKEN }} | |
steps: | |
- name: Checkout whisper-kit-expo | |
uses: actions/checkout@v4 | |
with: | |
repository: seb-sep/whisper-kit-expo | |
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 | |
else | |
echo "GitHub CLI is already installed" | |
fi | |
- name: PR with changes | |
run: | | |
echo ${{ secrets.COMMITTER_TOKEN }} | gh auth login --with-token | |
gh pr create --title "Update WhisperKit to $TAG" --body "Update WhisperKit to $TAG" --base main --head $BRANCH_NAME | |