bugfixes #7
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 Build | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build-backend: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Build Spring Boot | |
| working-directory: ./backend | |
| run: mvn clean package | |
| - name: Run backend unit tests | |
| working-directory: ./backend | |
| run: mvn test | |
| - name: Docker build backend | |
| run: docker build -t my-backend ./backend | |
| build-frontend: | |
| runs-on: ubuntu-latest | |
| needs: build-backend | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Node.js setup | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies and build | |
| working-directory: ./frontend | |
| run: | | |
| npm install | |
| npm run build | |
| - name: Run frontend unit tests | |
| working-directory: ./frontend | |
| run: npm test -- --watchAll=false | |
| - name: Docker build frontend | |
| run: docker build -t my-frontend ./frontend | |
| approve-release: | |
| needs: [build-backend, build-frontend] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: trstringer/manual-approval@v1 | |
| with: | |
| approvers: "" | |
| minimum-approvals: 1 | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| needs: [approve-release] | |
| steps: | |
| - name: Create GitHub release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: ${{ github.ref_name }} | |
| name: "Release ${{ github.ref_name }}" | |
| body: "Automated release from CI/CD workflow." | |
| infra-plan: | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| needs: [release] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Terraform | |
| uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: 1.9.5 | |
| - name: Terraform init | |
| working-directory: ./infra | |
| run: terraform init | |
| - name: Terraform validate | |
| working-directory: ./infra | |
| run: terraform validate | |
| - name: Terraform plan | |
| working-directory: ./infra | |
| run: terraform plan -var="version=${{ github.ref_name }}" |