Skip to content

Issue/2009 Notifications Added #1701

Issue/2009 Notifications Added

Issue/2009 Notifications Added #1701

Workflow file for this run

name: Run Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run tests with Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
# caches yarn dependencies in the yarn cache (not npm_modules)
# should help to speed up yarn install and be safe
# across changes to the repo and platforms
- name: Cache Yarn Deps
uses: c-hive/gha-yarn-cache@v1
- run: echo "github.ref = ${{ github.ref }}"
# frozen lockfile should make the cache more effective
# and our tests more predictable
- run: yarn install --frozen-lockfile
# run prettier against all the code
- name: Run Prettier
run: yarn prettier:run
# verify that running prettier didn't cause any changes
# will fail the PRs that need prettier run on them
- name: Does Prettier Need to Be Run
run: git --no-pager diff --exit-code -- .
- run: yarn test:ci
build_docker_images:
needs: test
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Capture Tag Name
id: tag_name
run: echo ::set-output name=GIT_TAG::${GITHUB_REF#refs/tags/}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.CR_USER }}
password: ${{ secrets.CR_PAT }}
- name: Checkout code
uses: actions/checkout@v2
- name: Build App Image
run: |
cd docker
docker-compose build
- name: Push App Images
run: |
docker tag ucfopen/obojobo:app-dev ghcr.io/${{ github.repository_owner }}/obojobo:app-${{ github.sha }}
docker tag ucfopen/obojobo:app-dev ghcr.io/${{ github.repository_owner }}/obojobo:app-${{ steps.tag_name.outputs.GIT_TAG }}
docker tag ucfopen/obojobo:nginx-dev ghcr.io/${{ github.repository_owner }}/obojobo:nginx-${{ github.sha }}
docker tag ucfopen/obojobo:nginx-dev ghcr.io/${{ github.repository_owner }}/obojobo:nginx-${{ steps.tag_name.outputs.GIT_TAG }}
docker push ghcr.io/${{ github.repository_owner }}/obojobo:app-${{ github.sha }}
docker push ghcr.io/${{ github.repository_owner }}/obojobo:app-${{ steps.tag_name.outputs.GIT_TAG }}
docker push ghcr.io/${{ github.repository_owner }}/obojobo:nginx-${{ github.sha }}
docker push ghcr.io/${{ github.repository_owner }}/obojobo:nginx-${{ steps.tag_name.outputs.GIT_TAG }}
deploy_npm_packages:
needs: test
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: NPM - Test, Build, Deploy
uses: actions/setup-node@v1
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- name: Cache Yarn Deps
uses: c-hive/gha-yarn-cache@v1
# frozen lockfile should make the cache more effective
# and our tests more predictable
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn release:publish --yes
env:
NODE_AUTH_TOKEN: ${{secrets.TR_NPM_PASSWORD}}