Skip to content

Update main.yml

Update main.yml #13

Workflow file for this run

#original https://www.programonaut.com/how-to-deploy-a-git-repository-to-a-server-using-github-actions/
name: Deploy to surge.sh
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]
workflow_dispatch:
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
# create a place to store your env.vars and secret.vars via https://github.com/ktsuttlemyre/kqDraft/settings/environments
GH_ENVIRONMENT: ktsuttle-dev
# Set it to the email address you use with Surge
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }}
# SURGE_TOKEN: Set it to your login token (get it by doing a surge token)
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
jobs:
Deploy-to-Surge:
name: Deploy
runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
environment:
name: ${GH_ENVIRONMENT}
url: ${env.CNAME}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '14'
- run: |
if [[ -z "${SURGE_LOGIN}" ]] || [[ -z "${SURGE_TOKEN}" ]]; then echo "Make sure SURGE_TOKEN and SURGE_LOGIN are set" ; exit 1; fi
npm install --global surge
surge . ${{ env.CNAME }}