Skip to content

[NDS-87] feat: Tabs #809

[NDS-87] feat: Tabs

[NDS-87] feat: Tabs #809

Workflow file for this run

name: CI/CD
on:
push:
branches:
- 'master'
- 'next'
pull_request:
branches:
- "**"
env:
NODE_VERSION: '18.17'
PROJECT: designlab
# ^ Is important to note that the above is used as:
# * SENTRY project to deploy so naming must match
# * Repo badges creation and SENTRY
MAIN_BRANCH: 'master'
STAGING_BRANCH: 'next'
permissions:
deployments: write
packages: write
contents: read
id-token: write
jobs:
test:
name: Run Tests 🔬
runs-on: ubuntu-latest
steps:
- name: Checkout 📥
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
- run: |
yarn install
- name: Running tests
run: yarn test
select-deployment-target:
runs-on: ubuntu-latest
outputs:
target: ${{ steps.get-target.outputs.target }}
steps:
- name: Checkout 📥
uses: actions/checkout@v3
with:
fetch-depth: 0
- id: get-target
run: |
TARGET=review
if [[ ${{ github.event_name }} == "push" ]]; then
# TODO: The conditions here depend on the different deployment targets you have
if [[ ${{ github.ref }} == "refs/heads/master" ]]; then
TARGET=prod
elif [[ ${{ github.ref }} == "refs/heads/next" ]]; then
TARGET=next
fi
else
if [ ! -f .github/workflows/teardown.yml ]; then
echo "Set up the teardown flow and try again!"
exit 1
fi
fi
echo "target=$TARGET" >> $GITHUB_OUTPUT
deploy-app:
needs:
- select-deployment-target
- test
uses: Orfium/orfium-github-actions/.github/workflows/deploy-frontend.yml@master
concurrency: ${{ github.ref }}
with:
target-environment: ${{ needs.select-deployment-target.outputs.target }}
secrets:
ORG_PGP_TOKEN: ${{ secrets.ORG_PGP_TOKEN }}
deploy-docs:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
name: Deploy Docs
runs-on: ubuntu-latest
needs: deploy-app
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: yarn install
- name: Generate docs
run: yarn documentation:generate
- name: Clone docs repo
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: Orfium/docs
path: docs-repo
ssh-key: ${{ secrets.DOCS_DEPLOY_KEY }}
- name: Copy and commit docs
run: |
rm -rf $GITHUB_WORKSPACE/docs-repo/${GITHUB_REPOSITORY#*/}
mkdir -p $GITHUB_WORKSPACE/docs-repo/${GITHUB_REPOSITORY#*/}
cp -r typeDocs/* $GITHUB_WORKSPACE/docs-repo/${GITHUB_REPOSITORY#*/}/
cd $GITHUB_WORKSPACE/docs-repo/
git config --global user.email "[email protected]"
git config --global user.name "orfium-org"
git add .
git commit -m "Update ${GITHUB_REPOSITORY#*/} docs"
git push origin master
release:
needs:
- deploy-app
runs-on: ubuntu-latest
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/next') && github.event_name == 'push'
permissions:
packages: write
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get yarn cache 📦
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Prepare library
run: |
yarn install
yarn build:lib
- name: Release 📌
if: "github.event_name == 'push'"
env:
GITHUB_NPM_CONFIG_REGISTRY: 'https://npm.pkg.github.com/'
GITHUB_NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLIC_NPM_CONFIG_REGISTRY: 'https://registry.npmjs.org'
PUBLIC_NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release