Potential fixes for 3 code quality findings #547
This file contains hidden or 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: Continuous integration | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| inputs: | |
| deploy_prod: | |
| description: "Deploy v3 prod" | |
| required: true | |
| type: boolean | |
| jobs: | |
| dependencies: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup_environment | |
| - name: Install latest updates | |
| run: npm ci | |
| - name: Save cache | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| node_modules | |
| key: node_modules-${{ github.run_id }} | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: dependencies | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup_environment | |
| - run: npm run test | |
| format: | |
| runs-on: ubuntu-latest | |
| needs: dependencies | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup_environment | |
| - run: npm run format:check | |
| archlint: | |
| runs-on: ubuntu-latest | |
| needs: dependencies | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup_environment | |
| - run: npm run archlint | |
| build-prod: | |
| if: inputs.deploy_prod == true | |
| runs-on: ubuntu-latest | |
| needs: [ test, format, archlint ] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup_environment | |
| - run: npm run build-prod | |
| - name: Cache build | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| dist_build | |
| key: build-${{ github.sha }}-${{ github.run_id }} | |
| upload-artifact: | |
| if: inputs.deploy_prod == true | |
| runs-on: ubuntu-latest | |
| needs: [ build-prod ] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup_environment | |
| - name: Load build cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| dist_build | |
| key: build-${{ github.sha }}-${{ github.run_id }} | |
| - run: npm run zip | |
| - uses: actions/upload-artifact@v5 | |
| with: | |
| name: domain-story-modeler | |
| path: | | |
| dist/*.zip | |
| README.md | |
| if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` | |
| deploy-website-latest: | |
| if: inputs.deploy_prod == false | |
| runs-on: ubuntu-latest | |
| needs: [ test, format, archlint ] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup_environment | |
| - run: | | |
| npm run build | |
| CLONE_DIR=$(mktemp -d) | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "Egon.io Bot" | |
| git clone --single-branch --branch main "https://x-access-token:${{ secrets.EGON_IO_DEPLOYMENT_PAT }}@github.com/WPS/egon.io-website.git" "${CLONE_DIR}" | |
| rm -r "${CLONE_DIR}/app-latest-build" | |
| mkdir "${CLONE_DIR}/app-latest-build" | |
| cp -r dist_build/egon/* "${CLONE_DIR}/app-latest-build" | |
| cd "${CLONE_DIR}" | |
| git add . | |
| git commit -m "Deploy latest build" || true | |
| git push || true | |
| deploy-website-prod: | |
| if: inputs.deploy_prod == true | |
| runs-on: ubuntu-latest | |
| needs: [ test, format, archlint ] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup_environment | |
| - run: | | |
| npm run build-prod | |
| CLONE_DIR=$(mktemp -d) | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "Egon.io Bot" | |
| git clone --single-branch --branch main "https://x-access-token:${{ secrets.EGON_IO_DEPLOYMENT_PAT }}@github.com/WPS/egon.io-website.git" "${CLONE_DIR}" | |
| rm -rf "${CLONE_DIR}/app-v3" | |
| mkdir "${CLONE_DIR}/app-v3" | |
| cp -r dist_build/egon/* "${CLONE_DIR}/app-v3" | |
| cd "${CLONE_DIR}" | |
| git add . | |
| git commit -m "Deploy production build" || true | |
| git push || true | |
| publish-image: | |
| if: inputs.deploy_prod == true | |
| runs-on: ubuntu-latest | |
| needs: [ build-prod ] | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup_environment | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ghcr.io/wps/egon.io:latest |