sintaxi / surge

CLI for the surge.sh CDN
https://surge.sh
2.84k stars 135 forks source link

Support token auth for easy usages through CI/CD #507

Open Mahmoudgalalz opened 1 year ago

Mahmoudgalalz commented 1 year ago

Hello @sintaxi I'm asking if you are interested to support a GitHub Action for Auto deployment, I'm building one for general purpose

so if you are interested to support it it will be very great.

also Tagging the issue it will be more easy if we have a token to authenticate

Mahmoudgalalz commented 1 year ago

when I explored the code, I found there's another way to auth which is a token, and there's another flag that gives you your token, so I will be finishing working on the action today.

waiting to hear from you

Mahmoudgalalz commented 1 year ago

initially I build this and its work, there's some features will be added, like creating a 200.html and inject it to the dist forlder another feature, like usage of random domains, and 2sub-domain for both dev, and PR

this the usage of the action

on:
  push:
    branches: [ main ]

jobs:
  build_and_deploy:
    runs-on: ubuntu-latest
    name: Build the code
    steps:
      - name: checkout the project
        uses: actions/checkout@v3
      - name: install deps
        uses: actions/setup-node@v3
        with:
          node-version: v16.x
      - name: build the project
        run: |
         npm install -g pnpm
         pnpm i
         npm run build

      - name: deploying to surge
        uses: mahmoudgalalz/surge-action@v0.1.5
        with:
          domain: 'ghtop.surge.sh'
          path: './dist'
        env:
          SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}

https://github.com/mahmoudgalalz/surge-action

tbouffard commented 12 months ago

@Mahmoudgalalz thanks for sharing Do you know https://github.com/afc163/surge-preview/?

Mahmoudgalalz commented 12 months ago

I kept looking for smth like that, and I was going to implement the same feature on my own, so I think I should suggest adding my own current feature into it @tbouffard

tbouffard commented 12 months ago

Nice 😊

tbouffard commented 12 months ago

also Tagging the issue it will be more easy if we have a token to authenticate

It is already possible to use a token to perform actions with the surge CLI. All commands support the --token <token_value> option.