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 name: deploy
description: Deploy on maxammann.org description: Deploy on cloudflare
inputs: inputs:
source: source:

View File

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

View File

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

View File

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

View File

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