From d0dae9bed4249fc20064d903542e017e261e6f85 Mon Sep 17 00:00:00 2001 From: duartecoelho Date: Thu, 30 Dec 2021 14:13:40 +0000 Subject: [PATCH 1/2] switch to template --- .github/workflows/DeployOnMergeMain.yml | 95 +++++-------------------- .github/workflows/TestOnPR.yml | 53 +++++--------- 2 files changed, 37 insertions(+), 111 deletions(-) diff --git a/.github/workflows/DeployOnMergeMain.yml b/.github/workflows/DeployOnMergeMain.yml index 4586b54..2f38eac 100644 --- a/.github/workflows/DeployOnMergeMain.yml +++ b/.github/workflows/DeployOnMergeMain.yml @@ -1,83 +1,26 @@ -name: "Deploy - On branch main Push" +name: "Deploy - On branch main/release Push" on: - pull_request: - types: [closed] + push: branches: - main + - 'releases/**' paths-ignore: - - "package.json" - - "package-lock.json" + - 'package.json' + - 'package-lock.json' jobs: - # required, as github uses a dynamic user on each run to checkout and execute. It causes permissions issues. - Find-Container-Info: - if: github.event.pull_request.merged == true - runs-on: ubuntu-latest - outputs: - containerUser: ${{ steps.get-user.outputs.containerUser }} - - steps: - - id: get-user - run: echo "::set-output name=containerUser::`id -u`:`id -g`" - - Deploy-NPM-Component: - needs: Find-Container-Info - if: github.event.pull_request.merged == true - runs-on: ubuntu-20.04 - container: - image: registry.cloud.mov.ai/devops/npm-buildserver:latest - credentials: - username: ${{secrets.PORTUS_APP_USER}} - password: ${{secrets.PORTUS_APP_TOKEN}} - options: --user ${{ needs.Find-Container-Info.outputs.containerUser }} - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - token: ${{ secrets.NPM_TOKEN }} - - - name: Raise App version - run: | - git config --global user.name 'Automatic Raise' - git config --global user.email 'test@test' - npm version patch -m "Automatic Bump of build version" - git add package.* - git push - - name: Setup Github as proxy Registry - uses: actions/setup-node@v2 - with: - node-version: "16.x" - registry-url: "https://npm.pkg.github.com/mov-ai" - - - name: Install dependencies - run: npm ci --loglevel verbose - - - name: Build - run: npm run build - - - name: Check NPM log on failure - if: ${{ failure() }} - run: cat /github/home/.npm/_logs/*.log - # Skip tests for now - #- name: Run tests - # run: npm run test - - - name: Publish - run: npm publish - - # [On Pull request merge] Since the pipeline will run, have a nice communication that is not doing anything. - Skipped: - if: github.event.pull_request.merged == false - runs-on: ubuntu-20.04 - container: - image: registry.cloud.mov.ai/devops/tf-buildserver:latest - credentials: - username: ${{secrets.PORTUS_APP_USER}} - password: ${{secrets.PORTUS_APP_TOKEN}} - steps: - - run: | - echo PR #${{ github.event.number }} has been skipped since the pull request was not approved. + CI: + uses: MOV-AI/.github/.github/workflows/npm-workflow.yml@feature/v1 + with: + deploy: 'true' + run_tests: 'false' + secrets: + auto_commit_user: ${{ secrets.RAISE_BOT_COMMIT_USER }} + auto_commit_mail: ${{ secrets.RAISE_BOT_COMMIT_MAIL }} + registry_user: ${{ secrets.PORTUS_APP_USER }} + registry_password: ${{ secrets.PORTUS_APP_TOKEN }} + gh_token: ${{ secrets.GITHUB_TOKEN }} + sonar_token: ${{ secrets.SONAR_TOKEN }} + npm_token: ${{ secrets.NPM_TOKEN }} + diff --git a/.github/workflows/TestOnPR.yml b/.github/workflows/TestOnPR.yml index 20bf513..73ffdb2 100644 --- a/.github/workflows/TestOnPR.yml +++ b/.github/workflows/TestOnPR.yml @@ -1,43 +1,26 @@ -name: "CI - On branch dev Push" +name: "CI - On main/dev/release branches" on: pull_request: branches: - dev - main + - 'releases/**' paths-ignore: - - "package.json" - - "package-lock.json" + - 'package.json' + - 'package-lock.json' jobs: - Test-NPM-Component: - runs-on: ubuntu-20.04 - container: - image: registry.cloud.mov.ai/devops/npm-buildserver:latest - credentials: - username: ${{secrets.PORTUS_APP_USER}} - password: ${{secrets.PORTUS_APP_TOKEN}} - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - steps: - - name: Checkout - uses: actions/checkout@v1 - - - name: Setup Github as proxy Registry - uses: actions/setup-node@v2 - with: - node-version: "16.x" - registry-url: "https://npm.pkg.github.com/mov-ai" - - - name: Install dependencies - run: npm ci --loglevel verbose - - - name: Build - run: npm run build - - - name: Check NPM log on failure - if: ${{ failure() }} - run: cat /github/home/.npm/_logs/*.log - - # temporary comment till tests are fixed - #- name: Run tests - # run: npm run test + CI: + uses: MOV-AI/.github/.github/workflows/npm-workflow.yml@v1 + with: + deploy: 'false' + run_tests: 'false' + secrets: + auto_commit_user: ${{ secrets.RAISE_BOT_COMMIT_USER }} + auto_commit_mail: ${{ secrets.RAISE_BOT_COMMIT_MAIL }} + registry_user: ${{ secrets.PORTUS_APP_USER }} + registry_password: ${{ secrets.PORTUS_APP_TOKEN }} + gh_token: ${{ secrets.GITHUB_TOKEN }} + sonar_token: ${{ secrets.SONAR_TOKEN }} + npm_token: ${{ secrets.NPM_TOKEN }} + From ec72b9ffc97cd95e7262b8501740d43ee98a5f28 Mon Sep 17 00:00:00 2001 From: duartecoelho Date: Thu, 6 Jan 2022 11:16:04 +0000 Subject: [PATCH 2/2] fix typo --- .github/workflows/DeployOnMergeMain.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/DeployOnMergeMain.yml b/.github/workflows/DeployOnMergeMain.yml index 2f38eac..e46e3f5 100644 --- a/.github/workflows/DeployOnMergeMain.yml +++ b/.github/workflows/DeployOnMergeMain.yml @@ -11,7 +11,7 @@ on: jobs: CI: - uses: MOV-AI/.github/.github/workflows/npm-workflow.yml@feature/v1 + uses: MOV-AI/.github/.github/workflows/npm-workflow.yml@v1 with: deploy: 'true' run_tests: 'false'