Skip to content

Commit 6536b19

Browse files
authored
docs: Add v1.0.0 snapshot, version documentation, and release-based deployment (#13)
1 parent a672a32 commit 6536b19

File tree

3 files changed

+8199
-13
lines changed

3 files changed

+8199
-13
lines changed

.github/workflows/deploy.yml

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
name: Deploy to GitHub Pages
22

33
on:
4-
push:
5-
branches: [main]
6-
paths:
7-
- "tokens/**"
4+
release:
5+
types: [published]
86

97
jobs:
108
deploy:
119
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write # Required to push commits back to main
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v5
14+
with:
15+
ref: main # Checkout main branch, not the release tag
16+
fetch-depth: 0 # Fetch all history to access previous versions
1417

1518
- name: Setup Node.js
1619
uses: actions/setup-node@v3
@@ -24,6 +27,43 @@ jobs:
2427
- name: Validate token list
2528
run: npm run validate
2629

30+
- name: Update timestamp
31+
run: |
32+
# Update timestamp to current UTC time
33+
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%S.000Z")
34+
jq --arg ts "$TIMESTAMP" '.timestamp = $ts' tokens/token-list.json > tokens/token-list.json.tmp
35+
mv tokens/token-list.json.tmp tokens/token-list.json
36+
37+
# Commit timestamp update if changed
38+
if ! git diff --quiet tokens/token-list.json; then
39+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
40+
git config --local user.name "github-actions[bot]"
41+
git add tokens/token-list.json
42+
git commit -m "chore: Update timestamp for release [skip ci]"
43+
git push origin main
44+
fi
45+
46+
- name: Preserve current version as historical snapshot
47+
run: |
48+
# Get the current version being deployed
49+
CURRENT_VERSION=$(jq -r '"\(.version.major).\(.version.minor).\(.version.patch)"' tokens/token-list.json)
50+
51+
# Check if this version already exists in versions/
52+
if [ ! -f "versions/v${CURRENT_VERSION}.json" ]; then
53+
mkdir -p versions
54+
cp tokens/token-list.json versions/v${CURRENT_VERSION}.json
55+
echo "Preserved v${CURRENT_VERSION}.json as historical snapshot"
56+
57+
# Commit the historical snapshot back to main
58+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
59+
git config --local user.name "github-actions[bot]"
60+
git add versions/v${CURRENT_VERSION}.json
61+
git commit -m "chore: Preserve v${CURRENT_VERSION}.json as historical snapshot [skip ci]"
62+
git push origin main
63+
else
64+
echo "v${CURRENT_VERSION}.json already exists in versions/ directory"
65+
fi
66+
2767
- name: Create dist directory
2868
run: |
2969
mkdir -p dist
@@ -33,13 +73,13 @@ jobs:
3373
MAJOR=$(jq -r '.version.major' tokens/token-list.json)
3474
MINOR=$(jq -r '.version.minor' tokens/token-list.json)
3575
36-
# Copy with full version (e.g., v1.1.0.json)
76+
# Copy current version with full version (e.g., v1.1.0.json)
3777
cp tokens/token-list.json dist/v${VERSION}.json
3878
39-
# Copy with major.minor version (e.g., v1.1.json)
79+
# Copy with major.minor version (e.g., v1.1.json) - updates automatically
4080
cp tokens/token-list.json dist/v${MAJOR}.${MINOR}.json
4181
42-
# Copy with major version only (e.g., v1.json)
82+
# Copy with major version only (e.g., v1.json) - updates automatically
4383
cp tokens/token-list.json dist/v${MAJOR}.json
4484
4585
# Copy as latest (always points to newest)
@@ -48,6 +88,12 @@ jobs:
4888
# Copy base file
4989
cp tokens/token-list.json dist/token-list.json
5090
91+
# Copy all historical versions
92+
if [ -d "versions" ]; then
93+
cp versions/*.json dist/ 2>/dev/null || true
94+
echo "Copied historical versions from versions/ directory"
95+
fi
96+
5197
echo "Created versioned files: v${VERSION}.json, v${MAJOR}.${MINOR}.json, v${MAJOR}.json, latest.json"
5298
5399
- name: Deploy to GitHub Pages

README.md

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,38 @@ This repository contains a curated list of tokens supported by Request Network p
88

99
## Usage
1010

11-
The token list is available at:
11+
The token list is available in multiple versioned formats:
12+
13+
### Latest Version (Recommended)
1214
`https://requestnetwork.github.io/request-token-list/latest.json`
1315

14-
You can fetch the token list directly in your application:
16+
### Versioned URLs
17+
Pin to specific versions for stability:
18+
19+
- **Specific patch version**: `https://requestnetwork.github.io/request-token-list/v1.1.0.json`
20+
- **Latest minor version**: `https://requestnetwork.github.io/request-token-list/v1.1.json` (updates to v1.1.x automatically)
21+
- **Latest major version**: `https://requestnetwork.github.io/request-token-list/v1.json` (updates to v1.x.x automatically)
22+
23+
### Legacy Path
24+
For backward compatibility:
25+
`https://requestnetwork.github.io/request-token-list/token-list.json` (always points to latest)
26+
27+
### Example Usage
1528

29+
Fetch the latest token list:
1630
```typescript
1731
const tokenList = await fetch(
1832
"https://requestnetwork.github.io/request-token-list/latest.json"
1933
).then((res) => res.json());
2034
```
2135

36+
Pin to a specific version for production stability:
37+
```typescript
38+
const tokenList = await fetch(
39+
"https://requestnetwork.github.io/request-token-list/v1.1.0.json"
40+
).then((res) => res.json());
41+
```
42+
2243
## Token List Structure
2344

2445
Each token in the list contains the following information:
@@ -41,9 +62,32 @@ We welcome community contributions! To add a new token to the list:
4162

4263
1. Fork this repository
4364
2. Add your token information to `tokens/token-list.json`
44-
3. Make sure your token meets our requirements (see [CONTRIBUTING.md](./CONTRIBUTING.md))
45-
4. Run tests locally: `npm test`
46-
5. Create a Pull Request
65+
3. Bump the version appropriately:
66+
- **Patch** (x.x.1): Bug fixes, corrections to existing tokens
67+
- **Minor** (x.1.0): New token additions (most common)
68+
- **Major** (2.0.0): Breaking changes (e.g., removing tokens, changing schema)
69+
4. Make sure your token meets our requirements (see [CONTRIBUTING.md](./CONTRIBUTING.md))
70+
5. Run tests locally: `npm test`
71+
6. Create a Pull Request
72+
73+
**Note**: The timestamp is automatically updated when the deployment workflow runs after a release is published, marking the deployment time to GitHub Pages.
74+
75+
### Publishing a New Version
76+
77+
After merging changes to `main`:
78+
79+
1. Create a GitHub Release with a tag matching the version in `tokens/token-list.json` (e.g., `v1.2.0`)
80+
- The tag must use the format `v<MAJOR>.<MINOR>.<PATCH>` (e.g., `v1.2.0`)
81+
- Ensure the release tag matches the version in your token list exactly
82+
2. The deployment workflow will automatically:
83+
- Update the timestamp to the current deployment time
84+
- Preserve the new version as a historical snapshot in `versions/`
85+
- Deploy all versioned files to GitHub Pages
86+
- Make the new version available at all URL patterns
87+
88+
Monitor deployment progress in the [Actions tab](https://github.com/RequestNetwork/request-token-list/actions/workflows/deploy.yml) of this repository.
89+
90+
**Note**: The workflow does not validate that the release tag matches the version in `tokens/token-list.json`. If they don't match, the deployed version will use the version from the JSON file, not the release tag. Always ensure they match to avoid confusion.
4791

4892
## Development
4993

0 commit comments

Comments
 (0)