name: Deploy on: # allow manual dispatch workflow_dispatch: # run on PRs push: branches: - master concurrency: group: ${{ github.ref }} cancel-in-progress: true jobs: build: runs-on: ubuntu-latest env: CI: true steps: - name: Checkout uses: actions/checkout@v3 with: submodules: true - name: Set up JDK uses: actions/setup-java@v3 with: java-version: 17 distribution: temurin - name: Set up Node uses: actions/setup-node@v3 with: node-version: '16' - name: Set up pnpm uses: pnpm/action-setup@v2 with: version: 7 - name: Cache Maven Deps uses: actions/cache@v3 with: path: $GITHUB_WORKSPACE/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- - name: Cache pnpm uses: actions/cache@v3 with: path: "~/.pnpm-store" key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm- - name: Build backend working-directory: backend run: mvn --batch-mode --errors --fail-at-end --show-version --no-transfer-progress -Dmaven.repo.local=$GITHUB_WORKSPACE/.m2/repository install - name: Install frontend deps run: (cd frontend && pnpm install --frozen-lockfile && cd server && pnpm install --frozen-lockfile) - name: Lint frontend run: (cd frontend && pnpm lint:eslint) # - name: Sync forth and back with crowdin # uses: crowdin/github-action@1.4.0 # with: # upload_sources: true # download_translations: true # push_translations: false # create_pull_request: false # skip_untranslated_strings: true # config: 'crowdin.yml' # crowdin_branch_name: master # env: # CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} - name: Build frontend env: # keep these in sync with compose! BACKEND_HOST: "http://hangar_backend:8080" AUTH_HOST: "https://hangar-auth.benndorf.dev" PUBLIC_HOST: "https://hangar.benndorf.dev" DEBUG: "hangar:*" run: (cd frontend && pnpm build && cd server && pnpm build) - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ secrets.CR_USER }} password: ${{ secrets.CR_PAT }} - name: Build and push frontend Dockerfile uses: docker/build-push-action@v3 with: context: . file: chart/dockerfiles/frontend/Dockerfile tags: ghcr.io/papermc/hangar_frontend:latest push: true - name: Build and push backend Dockerfile uses: docker/build-push-action@v3 with: context: . file: chart/dockerfiles/backend/Dockerfile tags: ghcr.io/papermc/hangar_backend:latest push: true