Update head.html #207
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
# Sample workflow for building and deploying a Jekyll site to GitHub Pages | |
name: Deploy Jekyll site to Pages | |
on: | |
push: | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
# Build job | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.1" # Not needed with a .ruby-version file | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
cache-version: 0 # Increment this number if you need to re-download cached gems | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v4 | |
- name: Setup IndexNow | |
run: echo ${{ secrets.INDEXNOW_KEY }} > IndexNow-${{ secrets.INDEXNOW_KEY }}.txt | |
- name: Build with Jekyll | |
# Outputs to the './_site' directory by default | |
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" | |
env: | |
JEKYLL_ENV: production | |
- name: Upload artifact | |
# Automatically uploads an artifact from the './_site' directory by default | |
uses: actions/upload-pages-artifact@v3 | |
# Deployment job | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
# Push to IndexNow | |
indexnow: | |
if: github.repository == 'Young-Lord/Young-Lord.github.io' | |
runs-on: ubuntu-latest | |
needs: deploy | |
steps: | |
- name: IndexNow Action | |
uses: bojieyang/indexnow-action@v2 | |
with: | |
sitemap-location: "https://young-lord.github.io/sitemap.xml" | |
key: ${{ secrets.INDEXNOW_KEY }} | |
key-location: https://young-lord.github.io/IndexNow-${{ secrets.INDEXNOW_KEY }}.txt | |
archive-page: | |
name: Save posts to Wayback Machine | |
runs-on: ubuntu-latest | |
needs: deploy | |
if: github.event_name != 'workflow_dispatch' | |
steps: | |
# setup python | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
# install python packages | |
- name: Install packages | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests pyyaml | |
# find all modified files under `_posts` folder | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Find modified posts | |
id: changed-posts | |
uses: tj-actions/changed-files@v42 | |
with: | |
json: true | |
files: | | |
_posts/*.md | |
quotepath: false | |
safe_output: false | |
escape_json: false | |
since_last_remote_commit: true | |
# use all_changed_files | |
- name: Save Page | |
if: steps.changed-posts.outputs.all_changed_files != '[]' && steps.changed-posts.outputs.all_changed_files != '' | |
run: python .github/workflows/save_page.py | |
env: | |
all_changed_files: ${{ steps.changed-posts.outputs.all_changed_files }} | |
SAVEPAGENOW_ACCESS_KEY: ${{ secrets.SAVEPAGENOW_ACCESS_KEY }} | |
SAVEPAGENOW_SECRET_KEY: ${{ secrets.SAVEPAGENOW_SECRET_KEY }} |