initial commit #1
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: CI | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| BINGO_FRONTEND_IMAGE_NAME: ${{ github.repository }}-bingo-frontend | |
| BINGO_BE_IMAGE_NAME: ${{ github.repository }}-bingo-be | |
| jobs: | |
| build: | |
| permissions: | |
| contents: read | |
| packages: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 2 | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: 20 | |
| - name: Get Rush version | |
| id: rush-version | |
| run: echo "RUSH_VERSION=$(node -p "require('./rush.json').rushVersion")" >> $GITHUB_OUTPUT | |
| - name: Cache Rush | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| common/temp/install-run | |
| ~/.rush | |
| key: ${{ runner.os }}-rush-${{ steps.rush-version.outputs.RUSH_VERSION }} | |
| - name: Rush Install | |
| run: node common/scripts/install-run-rush.js install | |
| - name: Cache node modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| common/temp/node_modules | |
| **/node_modules | |
| key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-modules- | |
| - name: Verify Change Logs | |
| run: node common/scripts/install-run-rush.js change --verify | |
| - name: Rush rebuild | |
| run: node common/scripts/install-run-rush.js rebuild --verbose | |
| # - name: Run tests | |
| # run: node common/scripts/install-run-rush.js test --verbose | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: dist | |
| path: | | |
| packages/*/dist | |
| packages/*/lib | |
| packages/*/build | |
| docker-build: | |
| permissions: | |
| contents: read | |
| packages: write | |
| needs: build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| image: [bingo-frontend, bingo-be] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Download artifact | |
| uses: actions/download-artifact@v3 | |
| with: | |
| name: dist | |
| path: packages | |
| - name: Extract version or set default | |
| id: get_version | |
| shell: bash | |
| run: | | |
| VERSION=$(git describe --tags --abbrev=0 --always) | |
| if [[ $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+-(alpha|beta) ]]; then | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=latest" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Cache Docker layers | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/.buildx-cache | |
| key: ${{ runner.os }}-buildx-${{ matrix.image }}-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-buildx-${{ matrix.image }}- | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: ./packages/${{ matrix.image }} | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/bingo-simulator-${{ matrix.image }}:${{ steps.get_version.outputs.version }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=local,src=/tmp/.buildx-cache | |
| cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
| - name: Move cache | |
| run: | | |
| rm -rf /tmp/.buildx-cache | |
| mv /tmp/.buildx-cache-new /tmp/.buildx-cache |