Skip to content

ci: remove PR inner commits name lint check #2742

ci: remove PR inner commits name lint check

ci: remove PR inner commits name lint check #2742

Workflow file for this run

name: cohort360-main-pipeline
on:
push:
branches:
- '**'
tags:
- '**'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: actions/setup-node@v3
with:
node-version: 20.x
cache: 'npm'
- name: Install Dependencies
run: npm install
- name: Lint
run: npm run lint && npx tsc --noEmit
- name: Test
run: npm run coverage
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
publish:
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check correct tag and version
run: |
VERSION=$(cat package.json | grep version | head -1 | awk -F= "{ print $2 }" | sed 's/"version"://g' | sed 's/[",]//g' | tr -d '[[:space:]]')
CI_COMMIT_TAG=$(git tag --points-at HEAD | head -n 1)
echo "VERSION=$VERSION" >> $GITHUB_ENV
if [ "$CI_COMMIT_TAG" != "" ] && [ "$CI_COMMIT_TAG" != "$VERSION" ] && case "$VERSION" in *SNAPSHOT) false;; *) true;; esac; then echo "The version is not the same as the tag name"; exit 1; else echo "Publishing version $VERSION"; fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ github.ref == 'refs/heads/main' && format('aphpid/cohort360-frontend:{0},aphpid/cohort360-frontend:latest',env.VERSION) || format('aphpid/cohort360-frontend:{0}',env.VERSION) }}