TA-511 Fixing branch not set properly #491
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: Build test publish redeploy environment | |
| # Workflow should run on pushes/merged to develop and release branches. | |
| # These two cases should allow to build release and SNAPSHOT artifacts | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - 'release/**' | |
| env: | |
| JAVA_VERSION: 17 | |
| jobs: | |
| build: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Generate build number | |
| uses: einaregilsson/build-number@v3 | |
| with: | |
| token: ${{secrets.ACCESS_TOKEN}} | |
| - name: displaying build number | |
| run: echo "Build number $BUILD_NUMBER started." | |
| - name: Set up JDK version ${{env.JAVA_VERSION}} | |
| uses: actions/setup-java@v1 | |
| with: | |
| java-version: ${{env.JAVA_VERSION}} | |
| - name: Cache local Maven repository | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| - name: Run maven verify | |
| run: mvn verify | |
| - run: echo " This job's status is ${{ job.status }}." | |
| liquibase_test: | |
| needs: | |
| - build | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK version ${{env.JAVA_VERSION}} | |
| uses: actions/setup-java@v1 | |
| with: | |
| java-version: ${{env.JAVA_VERSION}} | |
| - name: Cache local Maven repository | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| - name: Run liquibase changelog | |
| run: | | |
| cd database | |
| mvn spring-boot:run -Dspring-boot.run.profiles=test | |
| - run: echo " This job's status is ${{ job.status }}." | |
| build-and-publish-maven: | |
| needs: | |
| - liquibase_test | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK version ${{env.JAVA_VERSION}} | |
| uses: actions/setup-java@v1 | |
| with: | |
| java-version: ${{env.JAVA_VERSION}} | |
| - name: Restoring cached dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Build maven artifact | |
| run: mvn package -P publish | |
| - name: Publish to GitHub Packages | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
| run: | |
| mvn deploy | |
| - name: Showing job status | |
| run: echo " This job's status is ${{ job.status }}." | |
| build-and-publish-docker-task-schema: | |
| secrets: inherit | |
| needs: | |
| - build-and-publish-maven | |
| uses: arturjarosz/Task/.github/workflows/build-and-publish-docker.yaml@develop | |
| with: | |
| latest: true | |
| chosen-module: "task-schema" | |
| build-and-publish-docker-task-sample-data: | |
| secrets: inherit | |
| needs: | |
| - build-and-publish-maven | |
| uses: arturjarosz/Task/.github/workflows/build-and-publish-docker.yaml@develop | |
| with: | |
| latest: true | |
| chosen-module: "task-sample-data" | |
| build-and-publish-docker-task-task-backend: | |
| secrets: inherit | |
| needs: | |
| - build-and-publish-maven | |
| uses: arturjarosz/Task/.github/workflows/build-and-publish-docker.yaml@develop | |
| with: | |
| latest: true | |
| chosen-module: "task-backend" | |
| check-current-branch: | |
| runs-on: ubuntu-22.04 | |
| outputs: | |
| BRANCH: ${{ steps.check_branch.outputs.BRANCH }} | |
| steps: | |
| - name: check branch | |
| id: check_branch | |
| shell: bash | |
| run: | | |
| echo "Setting up branch name" | |
| echo "BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_OUTPUT" | |
| redeploy-environments: | |
| if: needs.check-current-branch.outputs.BRANCH == 'develop' | |
| needs: | |
| - build-and-publish-docker-task-task-backend | |
| - build-and-publish-docker-task-sample-data | |
| - build-and-publish-docker-task-schema | |
| - check-current-branch | |
| uses: arturjarosz/Task/.github/workflows/redeploy-environment.yml@develop | |
| with: | |
| chosen_environment: "test-hetzner" | |
| secrets: inherit |