Skip to content

VKT(Frontend): Refactor frontend URL structure [deploy] #1005

VKT(Frontend): Refactor frontend URL structure [deploy]

VKT(Frontend): Refactor frontend URL structure [deploy] #1005

name: Shared Frontend
on:
workflow_dispatch:
push:
paths:
- "frontend/packages/shared/**"
- "!**/*.md"
# Setting 'branches' has the side effect that just pushing tags does not start workflows.
branches:
- '**'
env:
FRONTEND_DIR: ./frontend
GITHUB_REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
if: contains(github.event.head_commit.message, 'SHARED')
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.9.0]
steps:
- uses: actions/checkout@v3
- uses: szenius/[email protected]
with:
timezoneLinux: "Europe/Helsinki"
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v3
id: yarn-cache
with:
path: "**/node_modules"
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('frontend/package.json') }}-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
working-directory: ${{ env.FRONTEND_DIR }}
run: |
yarn install --immutable
if: steps.yarn-cache.outputs.cache-hit != 'true'
- name: Run Linters
working-directory: ${{ env.FRONTEND_DIR }}
run: yarn shared:lint
- name: Format
working-directory: ${{ env.FRONTEND_DIR }}
run: yarn shared:format
- name: Run Jest Tests
working-directory: ${{ env.FRONTEND_DIR }}
run: yarn shared:test:jest
- name: Publish to GitHub Packages
if: |
github.ref == 'refs/heads/dev' || contains(github.event.head_commit.message, '[deploy]')
working-directory: ${{ env.FRONTEND_DIR }}/packages/shared
run: yarn npm publish
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}