Update build.yml #161
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: Open Commercial CI | |
on: | |
push: | |
branches: | |
- globodeoro | |
pull_request: | |
types: [ opened, synchronize, reopened ] | |
jobs: | |
build-analyze-deploy: | |
name: Build, analyze, dockerize, and publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js environment | |
uses: actions/[email protected] | |
with: | |
node-version: 16.13 | |
- name: Build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
ENV_NAME: production | |
run: | | |
npm install | |
npm run build | |
- name: SonarCloud Scan | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Generate changelog | |
if: ${{ github.ref == 'refs/heads/master' }} | |
uses: Bullrich/generate-release-changelog@master | |
id: changelog | |
env: | |
REPO: ${{ github.repository }} | |
- name: Get release version | |
if: ${{ github.ref == 'refs/heads/master' }} | |
run: | | |
echo "RELEASE_VERSION=$(npm pkg get version | sed 's/"//g')" >> $GITHUB_ENV | |
- name: Create Release | |
if: ${{ github.ref == 'refs/heads/master' }} | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.RELEASE_VERSION }} | |
release_name: ${{ env.RELEASE_VERSION }} | |
body: | | |
${{ steps.changelog.outputs.changelog }} | |
- name: Set up QEMU | |
if: ${{ github.ref_name == 'globodeoro' }} | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
if: ${{ github.ref_name == 'globodeoro' }} | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
if: ${{ github.ref_name == 'globodeoro' }} | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push Docker image | |
if: ${{ github.ref_name == 'globodeoro' }} | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
tags: opencommercial/ops-web:globodeoro |