publish-backend #1
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
| --- | |
| #----------------------------------------------------------------------------------------- | |
| # | |
| # Публикация bugget-api (backend) | |
| # | |
| #----------------------------------------------------------------------------------------- | |
| name: publish-backend | |
| description: "Сборка и публикация backend-образа bugget-api в Docker Hub" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Версия (например, v1.2.3)" | |
| required: true | |
| jobs: | |
| backend: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@master | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKER_LOGIN }} | |
| password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
| - name: Set version | |
| run: | | |
| echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Build and push Backend Multi-Arch | |
| run: | | |
| cd backend | |
| docker buildx create --name mybuilder --use --bootstrap || docker buildx use mybuilder | |
| docker buildx inspect mybuilder --bootstrap | |
| docker buildx build \ | |
| --platform linux/amd64,linux/arm64 \ | |
| --cache-from=type=gha \ | |
| --cache-to=type=gha,mode=max \ | |
| -t ${{ secrets.DOCKER_LOGIN }}/bugget-api:${{ env.VERSION }} \ | |
| --push \ | |
| -f ./Bugget/Dockerfile . | |
| docker buildx build \ | |
| --platform linux/amd64,linux/arm64 \ | |
| --cache-from=type=gha \ | |
| --cache-to=type=gha,mode=max \ | |
| -t ${{ secrets.DOCKER_LOGIN }}/bugget-api:latest \ | |
| --push \ | |
| -f ./Bugget/Dockerfile . |