Skip to content

Production deployment v1.4.0 #29

Production deployment v1.4.0

Production deployment v1.4.0 #29

Workflow file for this run

name: Build and Push Docker Image to Prod
on:
push:
branches:
- prod
env:
PROJECT_ID: spry-bricolage-298920
REGION: us
IMAGE_NAME: us-docker.pkg.dev/spry-bricolage-298920/gcr.io/prod/react-ui
jobs:
build:
name: Build and Push image to GCR
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
# auto generate tag from label defined in Dockerfile
- name: Tag version
uses: Klemensas/action-autotag@stable
id: tag_version
with:
GITHUB_TOKEN: "${{ secrets.RELEASE_TOKEN }}"
# Create release notes
- name: Build changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@main
with:
configuration: 'release-changelog-builder-config.json'
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
# Create release
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
tag_name: ${{ steps.tag_version.outputs.tagname }}
release_name: Release ${{ steps.tag_version.outputs.tagname }}
body: ${{ steps.build_changelog.outputs.changelog }}
draft: false
prerelease: false
- id: "auth"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GCR_JSON_KEY }}"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v1"
- name: "Use gcloud CLI"
run: "gcloud info"
- name: yarn install, build and test
run: |
yarn install
yarn run build:prod
- name: "Docker auth"
run: |-
gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet
# Build docker image
- name: Build docker image
run: docker build -t $IMAGE_NAME:latest .
# Push docker image to GCR
- name: Push to Google Container Registry
run: docker push $IMAGE_NAME:latest
# Send message on Slack
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_MESSAGE: 'Production Docker Image of buildly-ui pushed to Google Container Registry Successfully'
MSG_MINIMAL: true
# Send email alert
- name: Email Alert
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.MAIL_USERNAME }}
password: ${{ secrets.MAIL_PASSWORD }}
subject: Github Actions Build and Push job alert
to: ${{ secrets.RECIPIENT_EMAIL }}
from: ${{ secrets.SENDER_EMAIL }}
body: Production Docker Image of buildly-ui pushed to Google Container Registry Successfully