version-check #19
This file contains hidden or 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: 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@v5 | |
| - 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 |