fix[workflow]: deploy error #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 push --force https://$COMMIT_SECRET@github.com/$GITHUB_REPOSITORY.git main:gh-pages |