Automate manifest.json version updates during release #9

Merged
deluan merged 6 commits from claude/automate-manifest-versioning-MJ9WM into main 2026-02-07 18:17:09 -07:00
3 changed files with 7 additions and 5 deletions
Showing only changes of commit e913e0988f - Show all commits
+4 -4
View File
1
@@ -23,6 +23,9 @@ jobs:
exit 1 exit 1
fi fi
- name: Check out code
uses: actions/checkout@v5
- name: Check tag does not already exist - name: Check tag does not already exist
run: | run: |
if git ls-remote --tags origin "refs/tags/v${{ inputs.version }}" | grep -q .; then if git ls-remote --tags origin "refs/tags/v${{ inputs.version }}" | grep -q .; then
@@ -30,9 +33,6 @@ jobs:
exit 1 exit 1
fi fi
- name: Check out code
uses: actions/checkout@v5
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
copilot-pull-request-reviewer[bot] commented 2026-02-07 15:53:33 -07:00 (Migrated from github.com)
Review

This step runs git ls-remote ... origin ... before the repository is checked out, so it will fail with “not a git repository” / no origin remote. Move the “Check out code” step before this, or use the GitHub API to check for an existing tag.

This step runs `git ls-remote ... origin ...` before the repository is checked out, so it will fail with “not a git repository” / no `origin` remote. Move the “Check out code” step before this, or use the GitHub API to check for an existing tag.
@@ -49,6 +49,6 @@ jobs:
git config user.name "github-actions[bot]" git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com" git config user.email "github-actions[bot]@users.noreply.github.com"
git add manifest.json git add manifest.json
git commit -m "Release v${{ inputs.version }}" git commit --allow-empty -m "Release v${{ inputs.version }}"
git tag "v${{ inputs.version }}" git tag "v${{ inputs.version }}"
git push origin main "v${{ inputs.version }}" git push origin main "v${{ inputs.version }}"
+1 -1
View File
1
@@ -19,7 +19,7 @@ jobs:
- name: Verify manifest version matches tag - name: Verify manifest version matches tag
run: | run: |
TAG_VERSION="${GITHUB_REF_NAME#v}" TAG_VERSION="${GITHUB_REF_NAME#v}"
MANIFEST_VERSION=$(grep -oP '"version"\s*:\s*"\K[^"]+' manifest.json) MANIFEST_VERSION=$(jq -r .version manifest.json)
if [ "$TAG_VERSION" != "$MANIFEST_VERSION" ]; then if [ "$TAG_VERSION" != "$MANIFEST_VERSION" ]; then
echo "::error::Tag version ($TAG_VERSION) does not match manifest.json version ($MANIFEST_VERSION)" echo "::error::Tag version ($TAG_VERSION) does not match manifest.json version ($MANIFEST_VERSION)"
exit 1 exit 1
+2
View File
@@ -1,3 +1,4 @@
SHELL := /usr/bin/env bash
.PHONY: test build package clean .PHONY: test build package clean
PLUGIN_NAME := discord-rich-presence PLUGIN_NAME := discord-rich-presence
3
@@ -19,6 +20,7 @@ release: test
@if [[ ! "${V}" =~ ^[0-9]+\.[0-9]+\.[0-9]+.*$$ ]]; then echo "Usage: make release V=X.X.X"; exit 1; fi @if [[ ! "${V}" =~ ^[0-9]+\.[0-9]+\.[0-9]+.*$$ ]]; then echo "Usage: make release V=X.X.X"; exit 1; fi
go mod tidy go mod tidy
@if [ -n "`git status -s`" ]; then echo "\n\nThere are pending changes. Please commit or stash first"; exit 1; fi @if [ -n "`git status -s`" ]; then echo "\n\nThere are pending changes. Please commit or stash first"; exit 1; fi
@if [[ "$$(git branch --show-current)" != "main" ]]; then echo "Releases must be created from the main branch"; exit 1; fi
@# Update version in manifest.json @# Update version in manifest.json
@sed -i 's/"version": *"[^"]*"/"version": "${V}"/' manifest.json @sed -i 's/"version": *"[^"]*"/"version": "${V}"/' manifest.json
git add manifest.json git add manifest.json