-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add GitHub workflows for testing build and updating tabi
- Loading branch information
Showing
2 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Test build | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
name: Test Site Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Zola Build | ||
uses: shalzz/zola-deploy-action@v0.19.2 | ||
env: | ||
BUILD_ONLY: true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Update tabi theme | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "5 0 * * 1" # Weekly on Mondays at 5 past midnight UTC | ||
|
||
jobs: | ||
update-tabi: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
fetch-depth: 0 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
- name: Check for updates | ||
id: check | ||
run: | | ||
cd themes/tabi | ||
CURRENT=$(git rev-parse HEAD) | ||
git fetch | ||
git checkout origin/main | ||
NEW=$(git rev-parse HEAD) | ||
if [ "$CURRENT" != "$NEW" ]; then | ||
# Get the changelog with links to commits and PRs | ||
CHANGELOG=$(git log --pretty=format:"- %s [%h](https://github.com/welpo/tabi/commit/%H)" $CURRENT..$NEW | sed -E 's/#([0-9]+)/[#\1](https:\/\/github.com\/welpo\/tabi\/pull\/\1)/g') | ||
echo "has_changes=true" >> "$GITHUB_OUTPUT" | ||
echo "old_version=${CURRENT:0:7}" >> "$GITHUB_OUTPUT" | ||
echo "new_version=${NEW:0:7}" >> "$GITHUB_OUTPUT" | ||
echo "changelog<<EOF" >> "$GITHUB_OUTPUT" | ||
echo "$CHANGELOG" >> "$GITHUB_OUTPUT" | ||
echo "EOF" >> "$GITHUB_OUTPUT" | ||
fi | ||
cd ../.. | ||
- name: Create Pull Request | ||
if: steps.check.outputs.has_changes == 'true' | ||
run: | | ||
BRANCH="update-tabi-$(date +%Y%m%d-%H%M%S)" | ||
git checkout -b $BRANCH | ||
git add themes/tabi | ||
git commit -m "⬆️ Update tabi theme | ||
From: ${{ steps.check.outputs.old_version }} | ||
To: ${{ steps.check.outputs.new_version }} | ||
Update tabi to the latest version from https://github.com/welpo/tabi" | ||
git push origin $BRANCH | ||
gh pr create \ | ||
--title "⬆️ Update tabi theme" \ | ||
--body "## Changes in this update | ||
Updating \`themes/tabi\` from [\`${{ steps.check.outputs.old_version }}\`](https://github.com/welpo/tabi/commit/${{ steps.check.outputs.old_version }}) to [\`${{ steps.check.outputs.new_version }}\`](https://github.com/welpo/tabi/commit/${{ steps.check.outputs.new_version }}) | ||
### Changelog | ||
Submodule themes/tabi ${{ steps.check.outputs.old_version }}..${{ steps.check.outputs.new_version }}: | ||
${{ steps.check.outputs.changelog }} | ||
--- | ||
Auto-generated by the Update tabi theme workflow (in \`.github/workflows/update-tabi.yml\`)." | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |