messages/.github/workflows/deploy.yml

66 lines
1.7 KiB
YAML
Raw Normal View History

2021-09-25 16:05:24 +02:00
name: Deploy
on:
push:
2022-11-21 00:51:32 +01:00
branches: [ master ]
2022-11-21 00:42:39 +01:00
workflow_dispatch:
concurrency:
group: "pages"
cancel-in-progress: true
2021-09-25 16:05:24 +02:00
jobs:
2022-11-21 00:42:39 +01:00
build:
2021-09-25 16:05:24 +02:00
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: fkirc/skip-duplicate-actions@master
2023-08-23 20:02:57 +02:00
- uses: actions/checkout@v3
2021-09-25 16:05:24 +02:00
- uses: gradle/wrapper-validation-action@v1
2022-11-21 00:51:32 +01:00
- uses: actions/setup-java@v3
2021-09-25 16:05:24 +02:00
with:
2022-11-21 00:51:32 +01:00
distribution: 'zulu'
2021-09-25 16:05:24 +02:00
java-version: 11
2022-11-21 00:55:25 +01:00
- uses: actions/cache@v3
2021-09-25 16:05:24 +02:00
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}
- name: Generate messages
run: ./gradlew run
2022-11-21 00:42:39 +01:00
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./dist
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
2022-11-21 00:51:32 +01:00
permissions:
id-token: write
2022-11-21 00:55:25 +01:00
pages: write
2022-11-21 00:42:39 +01:00
needs: build
steps:
2021-09-25 16:05:24 +02:00
- name: Deploy to GitHub Pages
2022-11-21 00:42:39 +01:00
id: deployment
uses: actions/deploy-pages@v1
purge-cache:
runs-on: ubuntu-latest
needs: deploy
steps:
- name: "Call Cloudflare API"
2023-08-23 20:02:57 +02:00
uses: indiesdev/curl@v1
2021-09-25 16:05:24 +02:00
with:
2022-11-21 00:42:39 +01:00
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