Use custom gh pages deploy

This commit is contained in:
Mikołaj Pich 2022-11-21 00:42:39 +01:00
parent fecb5b7204
commit a3f900e88a
2 changed files with 37 additions and 28 deletions

View file

@ -2,10 +2,15 @@ name: Deploy
on:
push:
branches: [ master ]
branches: [$default-branch]
workflow_dispatch:
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
docs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
@ -23,10 +28,34 @@ jobs:
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}
- name: Generate messages
run: ./gradlew run
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@3.7.1
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: dist/
CLEAN: true
path: ./dist
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@v1
purge-cache:
runs-on: ubuntu-latest
needs: deploy
steps:
- name: "Call Cloudflare API"
uses: indiesdev/curl@v1.1
with:
method: "POST"
url: https://api.cloudflare.com/client/v4/zones/0dd93531047ba376c2a1167f841c2bfd/purge_cache
headers: ${{ secrets.custom_headers }}
bearer-token: ${{ secrets.bearer_token }}
body: '{"files": ["https://messages.wulkanowy.net.pl/", "https://messages.wulkanowy.net.pl/v1.json"]}'
accept: 200
log-response: false
retries: 3

View file

@ -1,20 +0,0 @@
name: Purge cloudflare cache
on: deployment_status
jobs:
publish:
if: github.event.deployment_status.state == 'success'
runs-on: ubuntu-latest
steps:
- name: "Call API"
uses: indiesdev/curl@v1.1
with:
method: "POST"
url: https://api.cloudflare.com/client/v4/zones/0dd93531047ba376c2a1167f841c2bfd/purge_cache
headers: ${{ secrets.custom_headers }}
bearer-token: ${{ secrets.bearer_token }}
body: '{"files": ["https://messages.wulkanowy.net.pl/", "https://messages.wulkanowy.net.pl/v1.json"]}'
accept: 200
log-response: false
retries: 3