Skip to content

chore: tweaks to upload modal styles #731

chore: tweaks to upload modal styles

chore: tweaks to upload modal styles #731

Workflow file for this run

name: BUILD
on:
push:
branches: [develop, release/**, rc/**, release]
jobs:
# Run tests for all branches (runs in parallel with build)
test:
uses: ./.github/workflows/test.yml
# Build job runs immediately without waiting for tests
build:
runs-on: ubuntu-latest
timeout-minutes: 3
outputs:
configuration: ${{ steps.build_ext.outputs.configuration }}
deploy_branch: ${{ steps.build_ext.outputs.deploy_branch }}
is_production: ${{ steps.build_ext.outputs.is_production }}
steps:
- uses: actions/checkout@v4
- name: Cache node modules
id: cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: '20'
- name: NPM install
if: steps.cache.outputs.cache-hit != 'true'
run: npm install --force
- name: Cache nx build cache
id: cache-nx
uses: actions/cache@v4
with:
path: node_modules/.cache/nx
key: ${{ runner.os }}-nx-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-nx-
- name: Setup version
run: npm run postinstall
- name: Extract branch name
id: branch_name
shell: bash
run: echo "name=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_OUTPUT
- name: Extract build configuration
shell: bash
id: build_ext
run: |
if [[ ${{ steps.branch_name.outputs.name }} == "release" ]] || [[ ${{ steps.branch_name.outputs.name }} == "release"* ]] || [[ ${{ steps.branch_name.outputs.name }} == "main" ]]
then
echo "configuration=production" >> $GITHUB_OUTPUT
echo "deploy_branch=prod" >> $GITHUB_OUTPUT
echo "is_production=true" >> $GITHUB_OUTPUT
elif [[ ${{ steps.branch_name.outputs.name }} == "rc"* ]]
then
echo "configuration=staging" >> $GITHUB_OUTPUT
echo "deploy_branch=uat" >> $GITHUB_OUTPUT
echo "is_production=true" >> $GITHUB_OUTPUT
else
echo "configuration=development" >> $GITHUB_OUTPUT
echo "deploy_branch=dev" >> $GITHUB_OUTPUT
echo "is_production=false" >> $GITHUB_OUTPUT
fi
- name: Initialise Pipeline Chat Status
uses: fjogeleit/http-request-action@master
continue-on-error: true
with:
url: ${{ secrets.STATUS_URL }}
data: '{ "chat_url": "${{ secrets.CHAT_URL }}", "name": "${{ github.repository }}", "commit": "${{ github.sha }}", "pipeline_name": "backoffice", "branch": "${{ github.ref }}", "status": "processing", "url": "https://github.com/${{ github.repository }}/runs/${{ github.run_id }}" }'
- name: Build application
run: npx nx build backoffice --verbose --configuration=${{ steps.build_ext.outputs.configuration }}
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: build-output
path: dist/backoffice/browser
retention-days: 1
# Deploy dev builds immediately after build (don't wait for tests)
deploy-dev:
needs: [build]
if: needs.build.outputs.is_production == 'false'
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build-output
path: dist/backoffice/browser
- name: Deploy the application
uses: MrYuion/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: build/${{ needs.build.outputs.deploy_branch }}
FOLDER: dist/backoffice/browser
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MESSAGE: 'build(backoffice): CI build from {sha}'
- name: Update Pipeline Chat Status
uses: fjogeleit/http-request-action@master
continue-on-error: true
with:
url: ${{ secrets.STATUS_URL }}
data: '{ "name": "${{ github.repository }}", "commit": "${{ github.sha }}", "pipeline_name": "backoffice", "branch": "${{ github.ref }}", "status": "${{ job.status }}", "url": "https://github.com/${{ github.repository }}/runs/${{ github.run_id }}" }'
if: ${{ always() }}
# Deploy production builds only after tests pass
deploy-production:
needs: [build, test]
if: needs.build.outputs.is_production == 'true'
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build-output
path: dist/backoffice/browser
- name: Deploy the application
uses: MrYuion/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: build/${{ needs.build.outputs.deploy_branch }}
FOLDER: dist/backoffice/browser
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MESSAGE: 'build(backoffice): CI build from {sha}'
- name: Update Pipeline Chat Status
uses: fjogeleit/http-request-action@master
continue-on-error: true
with:
url: ${{ secrets.STATUS_URL }}
data: '{ "name": "${{ github.repository }}", "commit": "${{ github.sha }}", "pipeline_name": "backoffice", "branch": "${{ github.ref }}", "status": "${{ job.status }}", "url": "https://github.com/${{ github.repository }}/runs/${{ github.run_id }}" }'
if: ${{ always() }}