-
Notifications
You must be signed in to change notification settings - Fork 24
117 lines (93 loc) · 3.58 KB
/
Copy pathversion-check.yml
File metadata and controls
117 lines (93 loc) · 3.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: version-check
on:
schedule:
- cron: "0 0 * * 1" # Weekly on Monday
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
check:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Check for updates
id: check
run: |
set -e # Exit on error
# Fetch API and extract latest timestamp
API_JSON=$(curl -sf https://puppetdoc.anytype.io/api/v1/prod-any-sync-compatible-versions/)
LATEST_TIMESTAMP=$(echo "$API_JSON" | jq -r 'keys | max')
# Extract current timestamp from go.mod comment
CURRENT_TIMESTAMP=$(grep 'Current timestamp:' go.mod | head -1 | sed 's/.*"\([0-9]*\)".*/\1/')
# Simple comparison: different timestamp = update available
if [ "$LATEST_TIMESTAMP" = "$CURRENT_TIMESTAMP" ]; then
echo "✅ Already up to date (timestamp: $CURRENT_TIMESTAMP)"
exit 0
fi
echo "📦 Update available: $CURRENT_TIMESTAMP → $LATEST_TIMESTAMP"
echo "needs_update=true" >> $GITHUB_ENV
echo "latest_ts=$LATEST_TIMESTAMP" >> $GITHUB_ENV
echo "current_ts=$CURRENT_TIMESTAMP" >> $GITHUB_ENV
# Store versions for issue body
echo "$API_JSON" | jq -r ".\"$LATEST_TIMESTAMP\"" > new_versions.json
- name: Create issue
if: env.needs_update == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
# Check if issue already exists
TITLE="Update to Anytype release ${{ env.latest_ts }}"
if gh issue list --search "$TITLE" --state open | grep -q .; then
echo "Issue already exists"
exit 0
fi
# Create simple issue body
cat > issue.md << 'EOF'
New Anytype versions available.
**Current:** ${{ env.current_ts }}
**Latest:** ${{ env.latest_ts }}
**Source:** https://puppetdoc.anytype.io/api/v1/prod-any-sync-compatible-versions/
EOF
# Add versions as simple list
jq -r 'to_entries | .[] | "- \(.key): v\(.value)"' new_versions.json >> issue.md
# Add update process
cat >> issue.md << 'EOF'
## Update
### 1. Edit `go.mod` directly
Update the version numbers for packages that changed (see above):
```
require (
github.com/anyproto/any-sync-consensusnode vX.Y.Z
github.com/anyproto/any-sync-coordinator vX.Y.Z
github.com/anyproto/any-sync-filenode vX.Y.Z
github.com/anyproto/any-sync-node vX.Y.Z
)
```
Also update the timestamp comment:
```
// Current timestamp: "${{ env.current_ts }}" → "${{ env.latest_ts }}"
```
### 2. Sync and verify dependencies
```bash
go mod tidy
go mod verify
```
### 3. Fix any API breaking changes
If the build fails, check the changelogs above for breaking changes and update code accordingly.
### 4. Run quality checks
```bash
golangci-lint run --fix ./...
go test -race -shuffle=on -vet=all -failfast ./...
go build -o any-sync-bundle .
```
### 5. Verify the binary
```bash
./any-sync-bundle --version
./any-sync-bundle --help
```
```
---
*Automated by version-check workflow*
EOF
gh issue create --title "$TITLE" --body-file issue.md --label dependencies --assignee grishy