|
| 1 | +name: CI Release |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | +jobs: |
| 7 | + build_frontend: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - name: Checkout frontend |
| 11 | + uses: actions/checkout@v4.1.7 |
| 12 | + with: |
| 13 | + sparse-checkout: 'frontend' |
| 14 | + - name: Install PNPM |
| 15 | + uses: pnpm/action-setup@v4.0.0 |
| 16 | + with: |
| 17 | + package_json_file: 'frontend/package.json' |
| 18 | + - name: Setup node env |
| 19 | + uses: actions/setup-node@v4.0.3 |
| 20 | + with: |
| 21 | + cache: 'pnpm' |
| 22 | + cache-dependency-path: 'frontend/pnpm-lock.yaml' |
| 23 | + check-latest: true |
| 24 | + node-version: 'lts/*' |
| 25 | + - name: Install dependencies |
| 26 | + run: pnpm install --frozen-lockfile |
| 27 | + working-directory: 'frontend' |
| 28 | + - name: Lint code |
| 29 | + run: pnpm prepare && pnpm lint |
| 30 | + working-directory: 'frontend' |
| 31 | + - name: Build frontend |
| 32 | + run: pnpm build |
| 33 | + working-directory: 'frontend' |
| 34 | + - name: Upload frontend artifact |
| 35 | + uses: actions/upload-artifact@v4.3.6 |
| 36 | + with: |
| 37 | + name: frontend-build |
| 38 | + path: frontend/dist/spa/ |
| 39 | + build_backend: |
| 40 | + needs: build_frontend |
| 41 | + runs-on: ubuntu-latest |
| 42 | + steps: |
| 43 | + - name: Checkout backend |
| 44 | + uses: actions/checkout@v4.1.7 |
| 45 | + with: |
| 46 | + sparse-checkout: 'backend' |
| 47 | + - name: Setup java env |
| 48 | + uses: actions/setup-java@v4.2.2 |
| 49 | + with: |
| 50 | + cache: 'gradle' |
| 51 | + distribution: 'temurin' |
| 52 | + java-version: '21' |
| 53 | + - name: Create needed folders for the frontend artifact |
| 54 | + run: | |
| 55 | + mkdir -p src/main/resources/static/ |
| 56 | + mkdir -p src/main/resources/templates/ |
| 57 | + working-directory: 'backend' |
| 58 | + - name: Download frontend artifact |
| 59 | + uses: actions/download-artifact@v4.1.8 |
| 60 | + with: |
| 61 | + name: frontend-build |
| 62 | + path: backend/src/main/resources/static/ |
| 63 | + - name: Move index.html from static to templates |
| 64 | + run: gradle bootJar |
| 65 | + working-directory: 'backend' |
| 66 | + - name: Upload backend artifact |
| 67 | + uses: actions/upload-artifact@v4.3.6 |
| 68 | + with: |
| 69 | + name: backend-build |
| 70 | + path: backend/build/libs/openapi-catalog-*.jar |
| 71 | + release: |
| 72 | + needs: build_backend |
| 73 | + runs-on: ubuntu-latest |
| 74 | + steps: |
| 75 | + - name: Download backend artifact |
| 76 | + uses: actions/download-artifact@v4.1.8 |
| 77 | + with: |
| 78 | + name: backend-build |
| 79 | + path: build/libs/ |
| 80 | + - name: Find artifact filename |
| 81 | + run: | |
| 82 | + echo "FILENAME=$(basename build/libs/openapi-catalog-*.jar)" >> "$GITHUB_ENV" |
| 83 | + - name: Create release tag |
| 84 | + run: | |
| 85 | + TAG_NAME=${{ github.event.head_commit.timestamp }} |
| 86 | + TAG_NAME=${TAG_NAME//:/-} |
| 87 | + echo "TAG_NAME=${TAG_NAME}" >> "$GITHUB_ENV" |
| 88 | + - name: Upload release |
| 89 | + uses: softprops/action-gh-release@v2 |
| 90 | + with: |
| 91 | + files: build/libs/${{ env.FILENAME }} |
| 92 | + make_latest: true |
| 93 | + tag_name: ${{ env.TAG_NAME }} |
0 commit comments