Release v0.3.1.10 #44
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: | |
tags: | |
- 'v*' # Trigger only on version tags like v1.0.0 | |
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 (Without Pushing) | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: false | |
load: true # Required to use docker cp in the next step | |
platforms: linux/amd64 # Only use a single platform for local extraction | |
tags: temp-build | |
- name: Copy Sourcemaps from Container | |
run: | | |
CONTAINER_ID=$(docker create temp-build) | |
docker cp $CONTAINER_ID:/sourcemaps-server ./sourcemaps-server | |
docker cp $CONTAINER_ID:/sourcemaps-client ./sourcemaps-client | |
docker rm $CONTAINER_ID | |
- name: Upload Sourcemaps to Sentry | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ vars.SENTRY_ORG }} | |
SENTRY_URL: ${{ vars.SENTRY_URL }} | |
run: | | |
# Install Sentry CLI | |
curl -sL https://sentry.io/get-cli/ | bash | |
RELEASE="react-nestjs-boilerplate@${{ env.VERSION }}" | |
sentry-cli releases new -p ${{ vars.SENTRY_PROJECT_FRONTEND }} "$RELEASE" | |
sentry-cli releases new -p ${{ vars.SENTRY_PROJECT_BACKEND }} "$RELEASE" | |
sentry-cli releases set-commits --commit "${{ github.repository }}@${{ github.sha }}" "$RELEASE" | |
# Upload server sourcemaps | |
sentry-cli releases files "$RELEASE" upload-sourcemaps ./sourcemaps-server \ | |
--rewrite --validate -p ${{ vars.SENTRY_PROJECT_BACKEND }} --url-prefix '~/apps/server/dist/' | |
# Upload frontend sourcemaps | |
sentry-cli releases files "$RELEASE" upload-sourcemaps ./sourcemaps-client \ | |
--rewrite --validate -p ${{ vars.SENTRY_PROJECT_FRONTEND }} | |
# Finalize the release | |
sentry-cli releases finalize "$RELEASE" | |
- name: Push Docker Image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64,linux/arm64 # Specify both amd64 and 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 |