Push DockerHub new image #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
| name: Release | |
| run-name: Push DockerHub new image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{github.workflow}} - ${{github.ref}} | |
| cancel-in-progress: false | |
| jobs: | |
| release: | |
| name: Create image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Checkout: " | |
| uses: actions/checkout@v4 | |
| - name: "Install pnpm: " | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| run_install: false | |
| - name: "Install Node: " | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: "pnpm" | |
| - run: pnpm install --frozen-lockfile | |
| # Получаем версию из package.json | |
| - name: Get version from package.json | |
| run: echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV | |
| # Логинимся в Docker Hub | |
| - name: Login to Docker Hub | |
| run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
| # Билдим и пушим образ в Docker Hub | |
| - name: Build and push Docker image | |
| run: | | |
| docker build --target prod -t flippo-frontend:${{ env.VERSION }} . | |
| docker push blackporetsky/flippo:flippo-frontend:${{ env.VERSION }} | |
| # Создаем GitHub Release | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ env.VERSION }} | |
| name: "Release v${{ env.VERSION }}" | |
| body: | | |
| ## 📦 Docker Image | |
| 🐳 `docker pull blackporetsky/flippo:flippo-frontend:${{ env.VERSION }}` | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |