Skip to content

edit deploy

edit deploy #20

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22'
- name: Cache Go modules
id: cache-go-mod
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build Go web server
run: go build -o server ./main.go
- name: Create deployment directory
run: mkdir -p deployment/static
- name: Copy necessary files to deployment directory
run: |
cp ./cards.cdb ./deployment/cards.cdb
cp -r ./static/css ./deployment/static/css
- name: Run web server
run: ./server &
env:
PORT: 8088
- name: Wait for server to start
run: |
sleep 1
curl -s http://localhost:8088 > deployment/index.html
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./deployment
publish_branch: gh-pages
force_orphan: true