Release v0.2.1 #32
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 backend sourcemaps to Sentry | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT_BACKEND }} | |
run: | | |
# Install Sentry CLI | |
curl -sL https://sentry.io/get-cli/ | bash | |
# Define the release version | |
RELEASE="react-nestjs-boilerplate-backend@${{ env.VERSION }}" | |
# Associate the release with Sentry | |
sentry-cli releases new "$RELEASE" | |
# Upload server sourcemaps | |
sentry-cli releases files "$RELEASE" upload-sourcemaps ./sourcemaps-server \ | |
--rewrite --validate | |
# Finalize the release | |
sentry-cli releases finalize "$RELEASE" | |
- name: Upload frontend sourcemaps to Sentry | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT_FRONTEND }} | |
run: | | |
# Define the release version | |
RELEASE="react-nestjs-boilerplate-frontend@${{ env.VERSION }}" | |
# Associate the release with Sentry | |
sentry-cli releases new "$RELEASE" | |
# Upload client sourcemaps | |
sentry-cli releases files "$RELEASE" upload-sourcemaps ./sourcemaps-client \ | |
--rewrite --validate | |
# 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 |