Workflow file for this run
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: Build and Push Docker Image | |
on: | |
push: | |
branches: | |
- task/upload-sourcemaps # Trigger on every push to this branch | |
tags: | |
- "v*" # Also trigger on version tags | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
install: true | |
- name: Create Buildx Builder | |
run: | | |
docker buildx create --name mybuilder --use | |
docker buildx inspect --bootstrap | |
- name: Extract Version Components | |
id: version | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/v} | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
echo "MAJOR=${VERSION%%.*}" >> $GITHUB_ENV | |
echo "MINOR=${VERSION%.*}" >> $GITHUB_ENV | |
- name: Build Docker Image with Sentry Sourcemaps | |
id: build | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: false # Build locally for source map uploads | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
jonathanschad/react-nestjs-boilerplate:${{ env.VERSION }} | |
jonathanschad/react-nestjs-boilerplate:${{ env.MAJOR }} | |
jonathanschad/react-nestjs-boilerplate:${{ env.MINOR }} | |
jonathanschad/react-nestjs-boilerplate:latest | |
- name: Upload Sentry Sourcemaps | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
run: | | |
export VERSION=${{ env.VERSION }} | |
npx @sentry/cli releases new $VERSION | |
npx @sentry/cli releases files $VERSION upload-sourcemaps --url-prefix '~/public' ./client/dist | |
npx @sentry/cli releases files $VERSION upload-sourcemaps --url-prefix '~/server' ./server/dist | |
npx @sentry/cli releases finalize $VERSION | |
- name: Push Docker Image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
jonathanschad/react-nestjs-boilerplate:${{ env.VERSION }} | |
jonathanschad/react-nestjs-boilerplate:${{ env.MAJOR }} | |
jonathanschad/react-nestjs-boilerplate:${{ env.MINOR }} | |
jonathanschad/react-nestjs-boilerplate:latest |