Schedule Posts Workflow (#2672)

Updated ```CUSTOMIZE.md``` to include information regarding the
```scheduler.yml``` action
This commit is contained in:
M. Umar Shahbaz 2024-09-09 22:36:44 +05:00 committed by GitHub
parent 97f78e5fb8
commit d50cdf6b8a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 68 additions and 0 deletions

39
.github/workflows/schedule-posts.txt vendored Normal file
View File

@ -0,0 +1,39 @@
name: Publish posts scheduled for today
on:
schedule:
# Run every day at 23:30 UTC or manually run
- cron: "30 23 * * *"
workflow_dispatch:
jobs:
publish_scheduled:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: master
- name: Get the date for today
id: date
run: echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Check for drafts and move to posts
run: |
echo "Today is $TODAY"
shopt -s nullglob
for file in _scheduled/${TODAY}-*.md; do
echo "Found scheduled: $file"
mv "$file" "_posts/"
echo "Moved $file to _posts/"
done
- name: Commit and push changes
run: |
git config user.name "github-actions"
git config user.email "actions@github.com"
git add _posts/
git add _scheduled/
git commit -m "Posted Scheduled Drafts on $TODAY" || echo "No changes to commit"
git push

View File

@ -169,3 +169,31 @@ Due to the necessary permissions (PAT and others mentioned above), it is recomme
## Customizing fonts, spacing, and more
You can customize the fonts, spacing, and more by editing [\_sass/\_base.scss](_sass/_base.scss). The easiest way to try in advance the changes is by using [chrome dev tools](https://developer.chrome.com/docs/devtools/css) or [firefox dev tools](https://firefox-source-docs.mozilla.org/devtools-user/). In there you can click in the element and find all the attributes that are set for that element and where are they. For more information on how to use this, check [chrome](https://developer.chrome.com/docs/devtools/css) and [firefox](https://firefox-source-docs.mozilla.org/devtools-user/page_inspector/how_to/examine_and_edit_css/index.html) how-tos, and [this tutorial](https://www.youtube.com/watch?v=l0sgiwJyEu4).
## Scheduled Posts
al-folio contains a workflow which automatically publishes all posts scheduled at a specific day, at the end of the day (23:30). By default the action is disabled, and to enable it you need to go to `.github/workflows/` and find the file called `schedule-posts.txt`. This is the workflow file. For GitHub to recognize it as one (or to enable the action), you need to rename it to `schedule-posts.yml`.
In order to use this you need to save all of your "Completed" blog posts which are scheduled to be uploaded on a specific date, in a folder named `_scheduled/` in the root directory.
> Incomplete posts should be saved in `_drafts/`
### Name Format
In this folder you need to store your file in the same format as you would in `_posts/`
example file: `2024-08-26-This file will be uploaded on 26 August.md`
### Important Notes:
- The scheduler uploads posts everyday at 🕛 23:30 UTC
- It will only upload posts at 23:30 UTC of their respective scheduled days, It's not uploaded in 23:59 in case there are a lot of files as the scheduler must finish before 00:00
- It will only upload files which follow the pattern `yyyy-mm-dd-title.md`
- This means that only markdown files will be posted
- It means that any markdown which do not follow this pattern will not be posted
- The scheduler works by moving posts from the `_scheduled/` directory to `_posts/`, it will not post to folders like `_projects/` or `_news/`
- The date in the name of the file is the day that file will be uploaded on
- `2024-08-27-file1.md` will not be posted before or after 27-August-2024 (Scheduler only works for posts scheduled on the present day)
- `2025-08-27-file2.md` will be posted exactly on 27-August-2025
- `File3.md` will not be posted at all
- `2026-02-31-file4.md` is supposed to be posted on 31-February-2026, but there is no 31st in February hence this file will never be posted either

View File

@ -150,6 +150,7 @@ Feel free to add your own page(s) by sending a PR.
<a href="https://mingsun-kaust.github.io/" target="_blank"></a>
<a href="https://hdocmsu.github.io/" target="_blank"></a>
<a href="https://trandangtrungduc.github.io/" target="_blank"></a>
<a href="https://kinghowler.github.io/" target="_blank"></a>
</td>
</tr>
<tr>