Skip to content

Commit efd035a

Browse files
authored
feat: add automated version management (#12)
1 parent c7a4ef2 commit efd035a

2 files changed

Lines changed: 84 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
commit-message:
8+
prefix: "chore"
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Check for New Version
2+
on:
3+
schedule:
4+
- cron: '0 9 * * MON' # Every Monday 9am UTC
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
check-version:
13+
runs-on: ubuntu-24.04
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Get versions
18+
id: versions
19+
run: |
20+
set -euo pipefail
21+
22+
# Get latest release from block/goose
23+
LATEST=$(gh api repos/block/goose/releases/latest --jq '.tag_name' | sed 's/^v//')
24+
CURRENT=$(yq '.inputs.version.default' action.yml)
25+
26+
echo "latest=$LATEST" >> $GITHUB_OUTPUT
27+
echo "current=$CURRENT" >> $GITHUB_OUTPUT
28+
echo "needs_update=$([[ "$LATEST" != "$CURRENT" ]] && echo true || echo false)" >> $GITHUB_OUTPUT
29+
env:
30+
GH_TOKEN: ${{ github.token }}
31+
32+
- name: Update version
33+
if: steps.versions.outputs.needs_update == 'true'
34+
run: |
35+
set -euo pipefail
36+
37+
LATEST="${{ steps.versions.outputs.latest }}"
38+
CURRENT="${{ steps.versions.outputs.current }}"
39+
40+
# Update action.yml
41+
yq -i ".inputs.version.default = \"$LATEST\"" action.yml
42+
43+
# Verify update
44+
UPDATED_ACTION=$(yq '.inputs.version.default' action.yml)
45+
if [[ "$UPDATED_ACTION" != "$LATEST" ]]; then
46+
echo "Error: action.yml update failed. Expected $LATEST, got $UPDATED_ACTION"
47+
exit 1
48+
fi
49+
50+
# Create PR
51+
git config user.name "github-actions[bot]"
52+
git config user.email "github-actions[bot]@users.noreply.github.com"
53+
git checkout -b update-version-${LATEST}
54+
git add action.yml
55+
git commit -m "chore: update default version to ${LATEST}"
56+
git push origin update-version-${LATEST}
57+
58+
gh pr create \
59+
--title "Update default version to ${LATEST}" \
60+
--body "## New Release Detected
61+
62+
**Previous version:** ${CURRENT}
63+
**New version:** ${LATEST}
64+
65+
**Release notes:** https://github.com/block/goose/releases/tag/v${LATEST}
66+
67+
### Changes
68+
- Updates default version in \`action.yml\`
69+
- README automatically reflects new version (links to action.yml)
70+
- Cache keys will automatically use new version
71+
- Users without explicit version will get ${LATEST}
72+
73+
**Note:** Users with pinned versions are unaffected." \
74+
--label "dependencies"
75+
env:
76+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)