Merge pull request #97 from newsIntelligent/refactor/#96 #144
This file contains hidden or 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: News Intelligent CI | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| jobs: | |
| build: | |
| # ubuntu 버전 지정 | |
| runs-on: ubuntu-22.04 | |
| env: | |
| REGISTRY: ${{secrets.DOCKERHUB_USERNAME}} | |
| IMAGE: ${{secrets.DOCKERHUB_REPOSITORY}} | |
| TAG: ${{github.sha}} | |
| steps: | |
| # GitHub 레포지토리 checkout | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| # DockerHub 로그인 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{secrets.DOCKERHUB_USERNAME}} | |
| password: ${{secrets.DOCKERHUB_ACCESS_TOKEN}} | |
| # Docker 이미지 빌드 및 푸시 | |
| - name: Build & Push Docker image | |
| run: | | |
| docker build --pull --no-cache -t $REGISTRY/$IMAGE:$TAG . | |
| docker push $REGISTRY/$IMAGE:$TAG | |
| # latest tag (develop branch) | |
| - name: Push :latest | |
| if: github.ref == 'refs/heads/develop' # push 이벤트에서 develop 일 때만 | |
| run: | | |
| docker tag $REGISTRY/$IMAGE:$TAG $REGISTRY/$IMAGE:latest | |
| docker push $REGISTRY/$IMAGE:latest |