Merge pull request #2 from adeptvin1/feature/fix-group-status-update #54
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: Build and Push Docker Images | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| release: | |
| types: [ published ] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install flake8 pylint mypy black isort | |
| pip install -r requirements.txt | |
| # - name: Run flake8 | |
| # run: flake8 server client | |
| # - name: Run pylint | |
| # run: pylint server client | |
| # - name: Run mypy | |
| # run: mypy server client | |
| # - name: Check formatting with black | |
| # run: black --check server client | |
| # - name: Check imports with isort | |
| # run: isort --check-only --profile black server client | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Login to DockerHub | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Extract metadata for Docker | |
| id: meta | |
| uses: docker/metadata-action@v4 | |
| with: | |
| images: ${{ secrets.DOCKERHUB_USERNAME }}/lwmecps-testapp | |
| - name: Build and push server image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| file: ./server/Dockerfile | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ secrets.DOCKERHUB_USERNAME }}/lwmecps-testapp-server:${{ github.sha }},${{ secrets.DOCKERHUB_USERNAME }}/lwmecps-testapp-server:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build and push client image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| file: ./client/Dockerfile | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ secrets.DOCKERHUB_USERNAME }}/lwmecps-testapp-client:${{ github.sha }},${{ secrets.DOCKERHUB_USERNAME }}/lwmecps-testapp-client:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Добавление тегов версии при релизе | |
| - name: Tag release version | |
| if: github.event_name == 'release' | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| docker tag ${{ secrets.DOCKERHUB_USERNAME }}/lwmecps-testapp-server:latest ${{ secrets.DOCKERHUB_USERNAME }}/lwmecps-testapp-server:${VERSION} | |
| docker tag ${{ secrets.DOCKERHUB_USERNAME }}/lwmecps-testapp-client:latest ${{ secrets.DOCKERHUB_USERNAME }}/lwmecps-testapp-client:${VERSION} | |
| docker push ${{ secrets.DOCKERHUB_USERNAME }}/lwmecps-testapp-server:${VERSION} | |
| docker push ${{ secrets.DOCKERHUB_USERNAME }}/lwmecps-testapp-client:${VERSION} |