message-gateway #62
This file contains 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 pipeline | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
- 'release/*' | |
pull_request: | |
branches: | |
- main | |
- develop | |
- 'release/*' | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
show-progress: false | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '16' | |
- name: Set up Java Version | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Build Message Gateway | |
run: | | |
VERSION_TAG=$(./gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}') | |
echo "VERSION_TAG=$VERSION_TAG" | |
IMAGE_TAGS="${VERSION_TAG}.$(date '+%Y.%m.%d').${{ github.run_number }}" | |
echo "IMAGE_SEMANTIC_HASH=$IMAGE_TAGS" | |
echo "Tags: $IMAGE_TAGS" | |
echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_ENV | |
echo "IMAGE_SEMANTIC_HASH=$IMAGE_TAGS" >> $GITHUB_ENV | |
echo "IMAGE_TAGS=$IMAGE_TAGS" >> $GITHUB_ENV | |
echo "GRADLE_USER_HOME=${HOME}/.gradle" >> $GITHUB_ENV | |
- name: Configure Gradle caching | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.GRADLE_USER_HOME }} | |
key: 'gradle | "${{ runner.os }}" | **/build.gradle' | |
restore-keys: | | |
gradle | "${{ runner.os }}" | |
gradle | |
- name: Gradlew build | |
run: | | |
./gradlew bootJar --info --build-cache | |
- name: Gradlew test | |
run: | | |
./gradlew :test --info --build-cache | |
- name: Build docker-compose | |
run: | | |
MESSAGE_GATEWAY_IMAGE_TAGS=${{ env.IMAGE_TAGS }} docker compose -f docker-compose.yml build | |
- name: Publish Code Coverage Results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: test-results | |
path: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml | |
- name: Login to Azure registry | |
uses: docker/[email protected] | |
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/release/') | |
with: | |
registry: oaftech.azurecr.io | |
username: ${{ vars.ACR_PULL_USERNAME }} | |
password: ${{ secrets.ACR_PULL_PASSWORD }} | |
- name: Push image to registry | |
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/release/') | |
run: | | |
docker push oaftech.azurecr.io/oneacrefund/message-gateway:${{ env.IMAGE_TAGS }} | |
- name: Publish configuration package | |
uses: actions/upload-artifact@v2 | |
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/release/') | |
with: | |
name: message-gateway | |
path: ${{ github.workspace }}/deployment |