workflow to manage web page

This commit is contained in:
John Bowdre 2024-03-07 09:44:51 -06:00
parent a60df1f3ed
commit d994540f5a
3 changed files with 61 additions and 1 deletions

32
.github/workflows/fetch-web.yml vendored Normal file
View file

@ -0,0 +1,32 @@
name: Fetch Web Page
on:
schedule:
- cron: "* */12 * * *"
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
fetch-web-page:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Web Page
run: |
response=$(curl --location --header "Authorization: Bearer ${{ secrets.OMG_TOKEN }}" \
"https://api.omg.lol/address/${{ secrets.OMG_ADDR }}/web" | \
jq -r .response)
jq -r .content <<< $response > web.md
jq -r .css <<< $response > web.css
jq -r .head <<< $response > web_head.html
- name: Commit Now Page
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'fetch web page'
file_pattern: 'web.md web.css web_head.html'

27
.github/workflows/update-web.yml vendored Normal file
View file

@ -0,0 +1,27 @@
name: Update Web Page
on:
push:
paths:
- 'web.md'
- 'web.css'
- 'web_head.html'
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
update-web-page:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Update Web Page
run: |
request_body='{"publish": true, "content": '"$(jq -Rsa . web.md)"', "css": '"$(jq -Rsa . web.css)"', "head": '"$(jq -Rsa . web_head.html)"'}'
curl --location --request POST --header "Authorization: Bearer ${{ secrets.OMG_TOKEN }}" \
"https://api.omg.lol/address/${{ secrets.OMG_ADDR }}/web" \
--data "$request_body"

View file

@ -3,4 +3,5 @@
This repo holds miscellaneous stuff I cobbled together for use with my [omg.lol profile](https://jbowdre.lol) and [associated services](https://home.omg.lol/referred-by/jbowdre). This repo holds miscellaneous stuff I cobbled together for use with my [omg.lol profile](https://jbowdre.lol) and [associated services](https://home.omg.lol/referred-by/jbowdre).
- [`tempest.yml`](.github/workflows/tempest.yml): display (near) realtime weather data on my omg profile (details at [runtimeterror.dev](https://runtimeterror.dev/display-tempest-weather-static-site/)) - [`tempest.yml`](.github/workflows/tempest.yml): display (near) realtime weather data on my omg profile (details at [runtimeterror.dev](https://runtimeterror.dev/display-tempest-weather-static-site/))
- [`fetch-now.yml`](.github/workflows/fetch-now.yml) / [`update-now.yml`](.github/workflows/update-now.yml): manage /now page - [`fetch-now.yml`](.github/workflows/fetch-now.yml) / [`update-now.yml`](.github/workflows/update-now.yml): manage omg /now page
- [`fetch-web.yml`](.github/workflows/fetch-web.yml) / [`update-web.yml`](.github/workflows/update-web.yml): manage omg web page