Merge pull request #44 from win-luck/feature/43-hotfix-test #23
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: CD | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request_target: | |
branches: [ "main" ] | |
types: [closed] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
deploy: | |
if: github.event.pull_request.merged == true | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Docker Login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Pull Docker Image | |
run: sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/puang | |
- name: Remove Old Docker Container | |
run: sudo docker rm -f puang || true | |
- name: Run Updated Docker Container | |
run: sudo docker run -t -d --name puang -p 8080:8080 ${{ secrets.DOCKERHUB_USERNAME }}/puang |