Created
August 12, 2024 21:01
-
-
Save llimllib/19bbe748d13da49233d501da04e63fb8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
name: Publish changes to the web | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout this repo | |
uses: actions/checkout@v4 | |
with: | |
# we need to check out all history so that we can get the modified | |
# and created times of the files within, which we use for showing the | |
# dates on the website. | |
fetch-depth: 0 | |
# obsidian notes is the program that publishes the obsidian archive to | |
# notes.billmill.org. Check it out into .github/obsidian_notes | |
- name: Checkout obsidian_notes | |
uses: actions/checkout@v4 | |
with: | |
repository: llimllib/obsidian_notes | |
ref: main | |
path: .github/obsidian_notes | |
# setup python and cache the requirements from the requirements file in | |
# obsidian_notes | |
# | |
# https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: pip | |
cache-dependency-path: .github/obsidian_notes/requirements.txt | |
- run: pip install -r .github/obsidian_notes/requirements.txt | |
- name: install dependencies | |
run: | | |
set -x | |
# install s3cmd and configure it, and libmagic1 which provides mime | |
# type guessing | |
sudo apt install -yqq s3cmd libmagic1 | |
printf "[default]\naccess_key = %s\nsecret_key = %s\nhost_base = nyc3.digitaloceanspaces.com\nhost_bucket = %%(bucket)s.nyc3.digitaloceanspaces.com" "$DO_ACCESS_KEY" "$DO_SECRET_KEY" > ~/.s3cfg | |
# install doctl | |
cd ${{ runner.temp }} | |
wget -q https://github.com/digitalocean/doctl/releases/download/v1.100.0/doctl-1.100.0-linux-amd64.tar.gz | |
tar xf ./doctl-1.100.0-linux-amd64.tar.gz | |
sudo mv ./doctl /usr/local/bin | |
doctl auth init -t "$DO_API_TOKEN" | |
env: | |
DO_ACCESS_KEY: ${{ secrets.DIGITAL_OCEAN_STORAGE_ACCESS_KEY }} | |
DO_SECRET_KEY: ${{ secrets.DIGITAL_OCEAN_STORAGE_SECRET_KEY }} | |
DO_API_TOKEN: ${{ secrets.DIGITAL_OCEAN_API_TOKEN }} | |
- name: Publish to notes.billmill.org | |
run: | | |
set -x | |
cd .github/obsidian_notes | |
MDPATH="$(realpath ../..)" make publish |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment