Deploy project to Deno server on need #4
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
name: Deploy project to Deno server on need | |
on: | |
workflow_dispatch: | |
inputs: | |
project: | |
description: 'Project to deploy. Options: mihomo-subs-converter / nodes-collector / xlsx2csv-demo' | |
default: 'mihomo-subs-converter' | |
required: true | |
type: string | |
permissions: | |
id-token: write # This is required to allow the GitHub Action to authenticate with Deno Deploy. | |
contents: read | |
env: | |
project-is-valid: ${{ !contains(fromJSON('["mihomo-subs-converter", "nodes-collector", "xlsx2csv-demo"]'), inputs.project) }} | |
jobs: | |
deploy-to-deno: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup deno | |
id: deno | |
uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v2.x | |
- name: Input not match | |
if: ${{ !env.project-is-valid }} | |
run: echo "Project '${{ inputs.project }}' is invaild." | |
# - name: Build project | |
# if: ${{ env.project-is-valid }} | |
# run: | | |
# echo "Deno version is ${{ steps.deno.outputs.deno-version }}" | |
# cd ${{ github.workspace }}/${{ inputs.project }} | |
# deno task build | |
- name: Upload to Deno Deploy | |
if: ${{ env.project-is-valid }} | |
uses: denoland/deployctl@v1 | |
with: | |
project: ${{ inputs.project }} | |
entrypoint: main.ts | |
root: ${{ inputs.project }} |