Skip to content

Commit

Permalink
Add deno deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
AnInternetTroll committed Apr 8, 2024
1 parent db20ae0 commit 5c248a8
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/deno.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Deno

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Setup repo
uses: actions/checkout@v2

- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Run checks
run: deno check app.tsx

publish:
if: github.repository == 'MCBE-Speedrunning/game-requests-serverless' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest

env:
DENO_DEPLOY_TOKEN: ${{ secrets.DENO_DEPLOY_TOKEN }}
BEDROCK: ${{ secrets.BEDROCK }}
JAVA: ${{ secrets.JAVA }}
OTHER: ${{ secrets.OTHER }}
PROJECT_NAME: "minecraft-speedrun-form"

steps:
- name: Setup repo
uses: actions/checkout@v2

- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Deploy
run: |
deno install -Arf https://deno.land/x/deploy/deployctl.ts
echo "CAPTCHA_PREFIX=$(</dev/urandom tr -dc -- "a-zA-Z0-9" | head -c "64")" > tmp.env
deployctl deploy \
--prod \
--color=never \
--entrypoint="./app.tsx" \
--project="$PROJECT_NAME" \
--env=BEDROCK="$BEDROCK" \
--env=JAVA="$JAVA" \
--env=OTHER="$OTHER" \
--env="CAPTCHA_PREFIX=$(</dev/urandom tr -dc -- "a-zA-Z0-9" | head -c "64")"
deployment_id="$(deployctl deployments list --project $PROJECT_NAME --format=json | jq -r '. |= sort_by(.createdAt) | reverse | .[].deployment.id' | head -n 1)"
deployctl deployments redeploy \
--prod \
--project=$PROJECT_NAME \
--id="$deployment_id"

0 comments on commit 5c248a8

Please sign in to comment.