surge icon indicating copy to clipboard operation
surge copied to clipboard

Support token auth for easy usages through CI/CD

Open Mahmoudgalalz opened this issue 1 year ago • 6 comments

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 avatar Jul 03 '23 02:07 Mahmoudgalalz

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 avatar Jul 03 '23 18:07 Mahmoudgalalz

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/[email protected]
        with:
          domain: 'ghtop.surge.sh'
          path: './dist'
        env:
          SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}

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

Mahmoudgalalz avatar Jul 04 '23 02:07 Mahmoudgalalz

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

tbouffard avatar Jul 05 '23 13:07 tbouffard

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

Mahmoudgalalz avatar Jul 05 '23 15:07 Mahmoudgalalz

Nice 😊

tbouffard avatar Jul 06 '23 06:07 tbouffard

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.

tbouffard avatar Jul 06 '23 08:07 tbouffard