Skip to content

Commit

Permalink
Merge branch 'master' into revamp-tag-versions
Browse files Browse the repository at this point in the history
  • Loading branch information
MattTheCuber committed Jan 2, 2025
2 parents 7a7208e + a025a3c commit 8903a33
Show file tree
Hide file tree
Showing 6 changed files with 239 additions and 225 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Validate, Update, and Deploy
name: Validate, Test, and Update

on:
push:
Expand Down Expand Up @@ -41,7 +41,12 @@ jobs:
run: pip install -r requirements.txt

- name: Render site
run: chert render
run: |
output=$(chert render 2>&1)
echo "$output"
if echo "$output" | grep -q "^E+"; then
exit 1
fi
update-and-deploy:
if: github.ref == 'refs/heads/master'
Expand All @@ -65,17 +70,22 @@ jobs:

- name: Generate updated projects.json file
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_USER: ${{ vars.GH_USER }}
GH_USER: github-actions[bot]
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python -u tools/gen_projects_json.py

- name: Publish new site
run: python -c "print('chert publish here...')"
- name: Test render site
run: |
output=$(chert render 2>&1)
echo "$output"
if echo "$output" | grep -q "^E+"; then
exit 1
fi
- name: Commit and Push Changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add projects.json
git commit -m "chore: update project.json"
git commit -m "chore: update project.json [skip ci]"
git push origin master
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Adding a project to [`projects.yaml`](projects.yaml) is typically a simple task.
| Key | ZeroVer or Emeritus | When to Add | Description | Example Value |
| ----------------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `name` | Either | Always | The name of the project | Big ZeroVer Project |
| `url` | Either | If the project has a webpage other than it's repository | The project's home page | https://example.com |
| `url` | Either | If the project has a webpage other than its repository | The project's home page | https://example.com |
| `gh_url` | Either | If the project has a GitHub repository | The project's GitHub repository link | https://github.com/example/test |
| `repo_url` | Either | If the project has a non-GitHub repository | The project's non-GitHub repository link | https://gitlab.com/example |
| `wp_url` | Either | If the project has a Wikipedia page | The project's Wikipedia link. | https://www.wikipedia.org/ |
Expand All @@ -61,7 +61,7 @@ Adding a project to [`projects.yaml`](projects.yaml) is typically a simple task.
| `star_count` | Either | If the project is not from GitHub and a star count can be obtained | The number of stars the project has | 10000 |
| `release_count` | ZeroVer only | If the project is currently ZeroVer and is not from GitHub or the repository on GitHub has an unusual tagging system | The number of releases the project has had | 100 |
| `release_count_zv` | Emeritus only | If the project is no longer ZeroVer and is not from GitHub or the repository on GitHub has an unusual tagging system | The number of releases the project has before it left 0ver | 50 |
| `latest_release_date` | ZeroVer only | If the project is currently ZeroVer and is not from GitHub or the repository on GitHub has an unusual tagging system | The date of the latest release | 2024-12-28 |
| `latest_release_date` | ZeroVer only | If the project is currently ZeroVer and is not from GitHub or the repository on GitHub has an unusual tagging system | The date of the latest release at time of writing | 2024-12-28 |
| `latest_release_version` | ZeroVer only | If the project is currently ZeroVer and is not from GitHub or the repository on GitHub has an unusual tagging system | The version of the latest release | 4.2.0 |
| `first_release_date` | Either | If the project is not from GitHub, the repository on GitHub has an unusual tagging system, or the first release tag is not on the GitHub repository | The date of the first release | 2000-01-01 |
| `first_release_version` | Either | If the project is not from GitHub, the repository on GitHub has an unusual tagging system, or the first release tag is not on the GitHub repository | The version of the first release | 0.0.1 |
Expand Down Expand Up @@ -170,8 +170,4 @@ Simply run `chert serve`.

## CI/CD

0ver uses [GitHub Actions](https://github.com/features/actions) to validate `projects.yaml`, update `project.json`, and publish new versions of the site. To configure CI/CD in a fork, you only need to set the environment variables.

1. Navigate to the project's Settings -> Secrets abd variables -> Actions.
2. In the Secrets tab, add a new repository secret named `GH_TOKEN` and paste your personal access token.
3. In the Variables tab, add a new repository variable named `GH_USER` and enter your GitHub username.
0ver uses [GitHub Actions](https://github.com/features/actions) to validate `projects.yaml`, test, and update `project.json`.
17 changes: 12 additions & 5 deletions custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

NA_VAL = "---"

def isoparse(s):
return datetime.datetime.fromisoformat(s.rstrip("Z"))


def chert_post_load(chert_obj):
# https://github.com/mahmoud/chert/blob/b4a91b5a66ec5f5002d6e67a2f880709e2e11326/chert/core.py#L840
Expand Down Expand Up @@ -77,10 +80,10 @@ def _zv_to_htmltable(entries):
]

def _get_row(entry):
irel_dt = datetime.datetime.fromisoformat(entry["first_release_date"])
irel_dt = isoparse(entry["first_release_date"])
lrel_dt, zv_streak = None, None
if entry.get("latest_release_date"):
lrel_dt = datetime.datetime.fromisoformat(entry["latest_release_date"])
lrel_dt = isoparse(entry["latest_release_date"])
zv_streak = datetime.datetime.now() - irel_dt.replace(tzinfo=None)
zv_streak_years = round(zv_streak.days / 365.0, 1)

Expand Down Expand Up @@ -142,10 +145,14 @@ def _emeritus_to_htmltable(entries):

rows = []
for entry in entries:
irel_dt = datetime.datetime.fromisoformat(entry["first_release_date"])
irel_dt = isoparse(entry["first_release_date"])
lrel_dt, zv_streak = None, None
if entry.get("first_nonzv_release_date"):
lrel_dt = datetime.datetime.fromisoformat(entry["first_nonzv_release_date"])
lrel_entry = entry.get("first_nonzv_release_date")
if lrel_entry:
lrel_dt = isoparse(lrel_entry)
else:
lrel_dt = datetime.datetime.now()

zv_streak = lrel_dt.replace(tzinfo=None) - irel_dt.replace(tzinfo=None)
zv_streak_years = round(zv_streak.days / 365.0, 1)

Expand Down
Loading

0 comments on commit 8903a33

Please sign in to comment.