Skip to content

deps: husky 9.1.7

deps: husky 9.1.7 #42

name: Release
on:
push:
branches:
- main
paths:
- 'package.json'
release:
types: [created]
jobs:
create-release:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Get Version
id: get_version
run: |
echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV
echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
- name: Install Dependencies
run: |
npm install
npm test
working-directory: .
- name: Build Electron App
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
npm run electron:build
ls -la
working-directory: .
- name: Upload Assets to Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
./dist/BrewMate-${{ env.VERSION }}-universal-mac.zip
draft: false
name: ${{ env.VERSION }}
tag_name: ${{ env.VERSION }}
generate_release_notes: true
- name: Generate SHA256 Checksum
run: |
shasum -a 256 ./dist/BrewMate-${{ env.VERSION }}-universal-mac.zip | awk '{print $1}' >> shasumver
echo "SHA 256:" >> $GITHUB_STEP_SUMMARY
cat shasumver >> $GITHUB_STEP_SUMMARY
- name: Checkout homebrew-cask repository
uses: actions/checkout@v4
with:
repository: romankurnovskii/homebrew-cask
path: homebrew-cask
token: ${{ secrets.TOKEN_HOMEBREW_CASK }}
# https://github.com/settings/tokens/
# https://github.com/romankurnovskii/BrewMate/settings/secrets/actions
- name: Update Cask | Create Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TOKEN_HOMEBREW_CASK: ${{ secrets.TOKEN_HOMEBREW_CASK }}
run: |
VERSION=$(jq -r .version package.json)
BRANCH_NAME=update-version-${VERSION}
SHA256=$(shasum -a 256 ./dist/BrewMate-${VERSION}-universal-mac.zip | awk '{print $1}')
git -C homebrew-cask config user.name "R K"
git -C homebrew-cask config user.email "[email protected]"
git -C homebrew-cask checkout -b ${BRANCH_NAME}
# Set new version
sed -i '' "s/version .*/version '${VERSION}'/" homebrew-cask/Casks/brewmate.rb
sed -i '' "s/sha256 .*/sha256 '${SHA256}'/" homebrew-cask/Casks/brewmate.rb
git -C homebrew-cask add .
git -C homebrew-cask commit -m "update to version ${VERSION}"
REPO_URL=$(git -C homebrew-cask remote get-url origin)
REPO_URL_WITH_TOKEN=$(echo "${REPO_URL}" | sed "s://://${TOKEN_HOMEBREW_CASK}@:")
git -C homebrew-cask remote set-url origin "${REPO_URL_WITH_TOKEN}"
# Delete the remote branch if it exists
git -C homebrew-cask push origin --delete ${BRANCH_NAME} || true
# Push the branch
git -C homebrew-cask push origin ${BRANCH_NAME}
# Create PR
PR_URL="https://api.github.com/repos/romankurnovskii/homebrew-cask/pulls"
curl --request POST \
--url $PR_URL \
--header "authorization: token ${TOKEN_HOMEBREW_CASK}" \
--header 'content-type: application/json' \
--data @- << EOF
{
"title": "Update BrewMate to ${VERSION}",
"body": " **${GITHUB_WORKFLOW}**. \n\n commit: _${GITHUB_SHA}_.",
"head": "${BRANCH_NAME}",
"base": "main"
}
EOF