Merge pull request #57 from osoc24/56-ama-setup-deployment #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Loama CD | |
on: | |
push: | |
branches: [ "root" ] | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: 'pages' | |
cancel-in-progress: true | |
jobs: | |
controller-build: | |
name: 'Controller Build' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: controller | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
- uses: pnpm/action-setup@v4 | |
name: Install PNPM | |
with: | |
version: latest | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
id: cache | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
name: Setup PNPM cache | |
env: | |
STORE_PATH: ${{ steps.cache.outputs.STORE_PATH }} | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Insall dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Run Typescript Check | |
run: pnpm run build >> $GITHUB_STEP_SUMMARY | |
- name: Save distribution files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: controller-dist | |
path: ${{github.workspace}}/controller/dist | |
build: | |
name: 'Deploy App' | |
runs-on: ubuntu-latest | |
needs: controller-build | |
defaults: | |
run: | |
working-directory: loama | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download controller dist | |
uses: actions/download-artifact@v4 | |
with: | |
name: controller-dist | |
path: ${{github.workspace}}/controller/dist | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
- uses: pnpm/action-setup@v4 | |
name: Install PNPM | |
with: | |
version: latest | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
id: cache | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
name: Setup PNPM cache | |
env: | |
STORE_PATH: ${{ steps.cache.outputs.STORE_PATH }} | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies of controller | |
working-directory: controller | |
run: pnpm install --frozen-lockfile | |
- name: Install dependencies of loama | |
run: pnpm install --frozen-lockfile | |
- name: Build applicaion | |
run: pnpm run build | |
- name: 'Dup `index.html` to `404.html` for redirects' | |
run: cp dist/index.html dist/404.html | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
# Upload dist folder | |
path: ${{github.workspace}}/loama/dist | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |