Bump the dependencies group across 1 directory with 6 updates #81
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
name: Build (PR) | |
on: | |
pull_request: | |
jobs: | |
build-app: | |
permissions: | |
contents: read | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: "Check if 'version-bypass' label is present" | |
id: check-label | |
run: | | |
LABELS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels") | |
echo "LABELS: $LABELS" | |
if echo "$LABELS" | jq -r '.[].name' | grep -q '^version-bypass$'; then | |
echo "bypass=true" >> $GITHUB_ENV | |
else | |
echo "bypass=false" >> $GITHUB_ENV | |
fi | |
- name: "Check release doesn't exist" | |
if: env.bypass != 'true' | |
run: | | |
# Check if package.json is among the changed files | |
if git diff --name-only HEAD~1 HEAD | grep -q 'package.json'; then | |
# Extract the devDependencies section from both the current and previous version | |
PREV_DEV_DEP=$(git show HEAD~1:package.json | jq -S '.devDependencies') | |
CURR_DEV_DEP=$(jq -S '.devDependencies' package.json) | |
# Extract the rest of the package.json sections for comparison | |
PREV_OTHER=$(git show HEAD~1:package.json | jq -S 'del(.devDependencies)') | |
CURR_OTHER=$(jq -S 'del(.devDependencies)' package.json) | |
# Check if only the devDependencies section has changed | |
if [ "$PREV_DEV_DEP" = "$CURR_DEV_DEP" ] && [ "$PREV_OTHER" = "$CURR_OTHER" ]; then | |
echo "Only devDependencies updated. Skipping release check." | |
exit 0 | |
fi | |
fi | |
# Extract the version from manifest.json | |
VERSION=$(jq -r '.Version' com.teddi.g502-battery-monitor.sdPlugin/manifest.json) | |
# Check if the release already exists | |
RESPONSE=$(curl --silent "https://api.github.com/repos/${{ github.repository }}/releases/tags/v$VERSION") | |
MESSAGE=$(echo $RESPONSE | jq -r '.message') | |
if [ "$MESSAGE" != "Not Found" ]; then | |
echo "Release v$VERSION already exists, please update the version in manifest.json" | |
exit 1 | |
fi | |
echo "VERSION=v$VERSION" >> $GITHUB_ENV | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 8 | |
run_install: true | |
- name: Build App | |
run: | | |
pnpm build |