diff --git a/.github/workflows/fetch-web.yml b/.github/workflows/fetch-web.yml new file mode 100644 index 0000000..267eda5 --- /dev/null +++ b/.github/workflows/fetch-web.yml @@ -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' + diff --git a/.github/workflows/update-web.yml b/.github/workflows/update-web.yml new file mode 100644 index 0000000..8743fa6 --- /dev/null +++ b/.github/workflows/update-web.yml @@ -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" + + diff --git a/README.md b/README.md index f631067..78399ba 100644 --- a/README.md +++ b/README.md @@ -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). - [`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 \ No newline at end of file +- [`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 \ No newline at end of file