|
15 | 15 | type: boolean |
16 | 16 |
|
17 | 17 | jobs: |
18 | | - build-image: |
| 18 | + build-course-hub-backend: |
19 | 19 | runs-on: ubuntu-latest |
20 | 20 | permissions: |
21 | 21 | contents: read |
@@ -53,13 +53,54 @@ jobs: |
53 | 53 |
|
54 | 54 | - name: Build |
55 | 55 | env: |
56 | | - DOCKER_PUSH: true |
| 56 | + DOCKER_PUSH: ${{ github.repository == 'HackYourFuture/CourseHub' }} |
57 | 57 | run: ./gradlew -Pversion=${{ steps.get-version.outputs.version }} bootBuildImage |
58 | 58 |
|
| 59 | + build-course-hub-frontend: |
| 60 | + runs-on: ubuntu-latest |
| 61 | + permissions: |
| 62 | + contents: read |
| 63 | + packages: write |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@v5 |
| 66 | + |
| 67 | + - uses: docker/setup-buildx-action@v3 |
| 68 | + with: |
| 69 | + platforms: linux/amd64 |
| 70 | + |
| 71 | + - uses: docker/login-action@v3 |
| 72 | + with: |
| 73 | + registry: ghcr.io |
| 74 | + username: ${{ github.actor }} |
| 75 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 76 | + |
| 77 | + - id: get-version |
| 78 | + run: | |
| 79 | + # Determine version from tag or input |
| 80 | + VERSION="${{ inputs.version || '' }}" |
| 81 | + if [ -z "$VERSION" ]; then |
| 82 | + VERSION="${GITHUB_REF_NAME#v}" |
| 83 | + fi |
| 84 | + echo "version=${VERSION}" >> $GITHUB_OUTPUT |
| 85 | +
|
| 86 | + - name: Build and push Docker image |
| 87 | + env: |
| 88 | + DOCKER_PUSH: ${{ github.repository == 'HackYourFuture/CourseHub' }} |
| 89 | + run: | |
| 90 | + docker build \ |
| 91 | + --build-arg VERSION=${VERSION} \ |
| 92 | + -t ghcr.io/hackyourfuture/course-hub-frontend:${{ steps.get-version.outputs.version }} \ |
| 93 | + -t ghcr.io/hackyourfuture/course-hub-frontend:latest \ |
| 94 | + . |
| 95 | + if [ "$DOCKER_PUSH" = "true" ]; then |
| 96 | + docker push ghcr.io/hackyourfuture/course-hub-frontend:${{ steps.get-version.outputs.version }} |
| 97 | + docker push ghcr.io/hackyourfuture/course-hub-frontend:latest |
| 98 | + fi |
| 99 | +
|
59 | 100 | deploy: |
60 | 101 | # do not execute on forks |
61 | 102 | if: ${{ github.repository == 'HackYourFuture/CourseHub' && inputs.deploy }} |
62 | | - needs: build-image |
| 103 | + needs: [build-course-hub-backend, build-course-hub-frontend] |
63 | 104 | permissions: |
64 | 105 | contents: read |
65 | 106 | uses: ./.github/workflows/deploy-to-digital-ocean.yml |
|
0 commit comments