Skip to content

Commit

Permalink
add devs synch tooling without commit history
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasphair committed Sep 8, 2024
1 parent e781e9a commit b5f13c6
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/synchronize.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Daily check for new Sphinx dockers to build against.

on:
schedule:
# Runs at midnight UTC every day.
- cron: '0 0 * * *'
workflow_dispatch:

jobs:
run-shell-script:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run a shell script
run: |
./bin/tryrelease
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ jobs:
docs-folder: "docs/"
```
* You can choose a Sphinx version by using the appropriate tag. For example, to
specify Sphinx 7.0.0 you would use `ammaraskar/sphinx-action@7.0.0`. `master`
currently uses Sphinx 2.4.4.

* If you have any Python dependencies that your project needs (themes,
build tools, etc) then place them in a requirements.txt file inside your docs
folder.
Expand Down
38 changes: 38 additions & 0 deletions bin/tryrelease
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

DOCKERFILE="Dockerfile"
: ${RUNNER_TEMP:=/tmp}


fetch_current_tags() {
gh api repos/:owner/:repo/git/refs/tags \
--jq '.[]' -q '.[] | .ref' |
cut -d'/' -f3 |
sort
}

fetch_sphinx_image_tags() {
gh api repos/sphinx-doc/sphinx-docker-images/git/refs/tags \
--jq '.[]' -q '.[] | .ref' |
cut -d'/' -f3 |
sort
}

NEW_TAGS="${RUNNER_TEMP}/new_tags.txt"
comm -13 <(fetch_current_tags) <(fetch_sphinx_image_tags) > "$NEW_TAGS"
if [ ! -s "$NEW_TAGS" ]; then
echo "No new tags found."
exit 0
fi

while IFS= read -r tag; do
sed -i "1s#.*#FROM sphinxdoc/sphinx:${tag}#g" "$DOCKERFILE"

git add "$DOCKERFILE"
git commit --message "build(release): release version ${tag}"
git tag "$tag"
git push --tags
done < "$NEW_TAGS"

rm "$NEW_TAGS"

0 comments on commit b5f13c6

Please sign in to comment.