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=1" >> $GITHUB_ENV | |
echo "MAJOR=1" >> $GITHUB_ENV | |
echo "MINOR=1" >> $GITHUB_ENV | |
- name: Build and Push Docker Image with Multiple Tags and Architectures | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: false | |
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 | |
- 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="jonathanschad/react-nestjs-boilerplate@${{ 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 --url-prefix "~/assets" --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: | | |
# Install Sentry CLI | |
curl -sL https://sentry.io/get-cli/ | bash | |
# Define the release version | |
RELEASE="jonathanschad/react-nestjs-boilerplate@${{ 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 --url-prefix "~/assets" --validate | |
# Finalize the release | |
sentry-cli releases finalize "$RELEASE" |