Deploy to cloudflare

This commit is contained in:
Maximilian Ammann 2022-06-03 11:53:32 +02:00
parent 4dbd47b09a
commit ded62d76b1
6 changed files with 86 additions and 54 deletions

View File

@ -0,0 +1,26 @@
name: deploy
description: Deploy on maxammann.org
inputs:
project:
required: true
description: TODO
source:
required: true
description: TODO
CF_API_TOKEN:
required: true
description: TODO
CF_ACCOUNT_ID:
required: true
description: TODO
runs:
using: "composite"
steps:
- name: Publish
uses: cloudflare/wrangler-action@2.0.0
with:
apiToken: ${{ inputs.CF_API_TOKEN }}
accountId: ${{ inputs.CF_ACCOUNT_ID }}
command: pages publish --project-name=${{ inputs.project }} ${{ inputs.source }}

View File

@ -1,5 +1,5 @@
name: deploy
description: Deploy on maxammann.org
description: Deploy on cloudflare
inputs:
source:

View File

@ -64,3 +64,4 @@ jobs:
with:
branch: gh-pages
folder: artifacts
target-folder: docs

View File

@ -1,21 +1,20 @@
name: Build library for WebGL
name: Build library for Web
on:
workflow_call:
secrets:
SSH_KEY_MAXAMMANN_ORG:
CF_API_TOKEN:
required: false
CF_ACCOUNT_ID:
required: false
inputs:
deploy:
required: true
type: boolean
webgl:
required: true
type: boolean
jobs:
library-web:
name: Build
library-webgl:
name: Build WebGL
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
@ -25,61 +24,80 @@ jobs:
run: just nightly-toolchain
- uses: Swatinem/rust-cache@v1
- name: Build lib
if: inputs.webgl
shell: bash
run: just web-lib esbuild-webgl
- name: Build demo
shell: bash
run: just web-demo build
- name: Check
shell: bash
run: just web-check "web-webgl"
- name: Test
shell: bash
run: |
# Install test runner
cargo install wasm-bindgen-cli --version "0.2.80"
just web-test "web-webgl"
- uses: actions/upload-artifact@v2
with:
name: webgpu-demo
path: web/demo/dist/
library-webgpu:
name: Build WebGPU
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: extractions/setup-just@v1
- name: Install nightly toolchain
shell: bash
run: just nightly-toolchain
- uses: Swatinem/rust-cache@v1
- name: Build lib
if: "!inputs.webgl"
shell: bash
run: just web-lib esbuild
- name: Build demo
shell: bash
run: just web-demo build
- name: Check
if: inputs.webgl
shell: bash
run: just web-check "web-webgl"
- name: Check
if: "!inputs.webgl"
shell: bash
run: just web-check ""
- name: Test
if: inputs.webgl
shell: bash
run: |
cargo install wasm-bindgen-cli --version "0.2.80"
just web-test "web-webgl"
- name: Test
if: "!inputs.webgl"
shell: bash
run: |
# Install test runner
cargo install wasm-bindgen-cli --version "0.2.80"
just web-test ""
- uses: actions/upload-artifact@v2
with:
name: webgpu-demo
name: webgl-demo
path: web/demo/dist/
deploy:
needs: library-web
needs: [library-webgl, library-webgpu]
if: inputs.deploy
name: Deploy
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: webgl-demo
path: demo/webgl
- uses: actions/download-artifact@v2
with:
name: webgpu-demo
path: demo
# - name: Deploy
# if: "!inputs.webgl"
# uses: ./.github/actions/deploy
# with:
# source: .
# destination: webgl
# key: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
# - name: Deploy
# if: "!inputs.webgl"
# uses: ./.github/actions/deploy
# with:
# source: .
# destination: webgpu
# key: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
path: demo/webgpu
- name: Set HTTP Headers for Cloudflare
shell: bash
run: |
echo "/*
Cross-Origin-Opener-Policy: \"same-origin\"
Cross-Origin-Embedder-Policy: \"require-corp\"" > demo/_headers
- name: Deploy
uses: ./.github/actions/cloudflare-deploy
with:
project: maplibre-rs-demos
source: demo
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}

View File

@ -20,17 +20,10 @@ jobs:
secrets: inherit
library-android:
uses: ./.github/workflows/library-android.yml
library-webgpu:
library-web:
uses: ./.github/workflows/library-web.yml
with:
deploy: true
webgl: false
secrets: inherit
library-webgl:
uses: ./.github/workflows/library-web.yml
with:
deploy: true
webgl: true
secrets: inherit
library-apple:
uses: ./.github/workflows/library-apple.yml

View File

@ -19,16 +19,10 @@ jobs:
deploy: false
library-android:
uses: ./.github/workflows/library-android.yml
library-webgpu:
library-web:
uses: ./.github/workflows/library-web.yml
with:
deploy: false
webgl: false
library-webgl:
uses: ./.github/workflows/library-web.yml
with:
deploy: false
webgl: true
library-apple:
uses: ./.github/workflows/library-apple.yml
demo-linux: