-
Notifications
You must be signed in to change notification settings - Fork 255
41 lines (37 loc) · 1.14 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Deploy to GitHub Page
on:
push:
branches: [main]
jobs:
build:
name: build and deploy
env:
COMMIT_SECRET: ${{secrets.COMMIT_SECRET}}
USER_NAME: songlh
USER_EMAIL: song.lhlh@gmail.com
DOCKER_DIR: /app/dist
GITHUB_REPOSITORY: paint-board
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build Docker image
run: |
docker build --target build-stage -t paint-board .
- name: Copy build output
run: |
container_id=$(docker create paint-board)
docker cp $container_id:${DOCKER_DIR} ./dist
docker rm $container_id
- name: Deploy to GitHub Pages
run: |
cd ./dist
git init
git config --local user.name $USER_NAME
git config --local user.email $USER_EMAIL
git add --all
git commit -m "Deploy to GitHub Pages"
git branch -M main
git push --force https://$COMMIT_SECRET@github.com/$GITHUB_REPOSITORY.git main:gh-pages