Skip to content

Commit

Permalink
switch to template
Browse files Browse the repository at this point in the history
  • Loading branch information
duartecoelhomovai committed Dec 30, 2021
1 parent 98a5958 commit d0dae9b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 111 deletions.
95 changes: 19 additions & 76 deletions .github/workflows/DeployOnMergeMain.yml
Original file line number Diff line number Diff line change
@@ -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 }}

53 changes: 18 additions & 35 deletions .github/workflows/TestOnPR.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit d0dae9b

Please sign in to comment.