Skip to content

Merge pull request #589 from IBM/latest #135

Merge pull request #589 from IBM/latest

Merge pull request #589 from IBM/latest #135

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: "CI diem-operator"
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
paths:
- "applications/diem-operator/**"
pull_request:
branches: [main]
paths:
- "applications/diem-operator/**"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
defaults:
run:
working-directory: applications/diem-operator
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: get-npm-version
id: package-version
run: echo "::set-output name=current-version::$(cat ${1-.}/package.json | jq '.version' | tr -d '"')"
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "16.x"
- run: npm ci
- run: npm run eslint --if-present
- run: npm run build --if-present
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
with:
projectBaseDir: applications/diem-operator
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Build the Docker image
run: docker build . --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --file docker/Dockerfile --tag quay.io/diem/operator:${{ steps.package-version.outputs.current-version}}
- name: Login to quay.io
run: echo "${{secrets.DOCKER_QUAY}}" | docker login -u="diem+ibm_deploy_robot" --password-stdin quay.io
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
- name: Push the Docker image
run: docker push quay.io/diem/operator:${{ steps.package-version.outputs.current-version}}
if: github.event_name == 'push' && github.ref == 'refs/heads/main'