This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- release | |
env: | |
PROJECT_NAME: glot | |
WASM_PACK_URL: https://github.com/rustwasm/wasm-pack/releases/download/v0.12.1/wasm-pack-v0.12.1-x86_64-unknown-linux-musl.tar.gz | |
POLY_CLI_URL: https://github.com/glotlabs/poly-cli/releases/download/0.1.0-alpha12/poly_linux-x64.tar.gz | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
name: Deploy | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install rust nightly | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
- name: Install wasm-pack | |
run: | | |
mkdir -p ${HOME}/bin | |
wget --quiet -O wasm-pack.tar.gz $WASM_PACK_URL | |
tar -zxf wasm-pack.tar.gz --directory ${HOME}/bin --strip 1 --no-anchored --wildcards wasm-pack | |
rm wasm-pack.tar.gz | |
- name: Install poly-cli | |
run: | | |
mkdir -p ${HOME}/bin | |
wget --quiet -O poly.tar.gz $POLY_CLI_URL | |
tar -zxf poly.tar.gz --directory ${HOME}/bin poly | |
rm poly.tar.gz | |
- name: Build project | |
run: | | |
PATH="${PATH}:${HOME}/bin" poly build --release --hash-assets --script post_build.sh | |
- name: Prepare cloudflare functions for deploy | |
run: | | |
cp -rf glot_cloudflare/functions . | |
cp -rf glot_cloudflare/dist_backend . | |
cp -rf glot_cloudflare/src . | |
- name: Publish | |
uses: cloudflare/wrangler-action@v3.3.2 | |
with: | |
apiToken: ${{ secrets.CF_API_TOKEN }} | |
accountId: ${{ secrets.CF_ACCOUNT_ID }} | |
command: pages deploy dist --branch main --project-name=${{ env.PROJECT_NAME }} |