Back merge Update on_release_created_or_updated.yml (#1603) #211
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
# This workflow will build a docker image and push to docker hub | |
# This workflow is triggered: | |
# 1. When commits are pushed or merged onto `develop` branch | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | |
name: Push/Merge to `develop` Branch | |
on: | |
push: | |
# when commits are pushed or pull requests merged onto `develop` branch | |
branches: [ develop ] | |
jobs: | |
gradle_build: | |
uses: ./.github/workflows/sub_gradle_build.yml | |
jacoco_report: | |
needs: [ gradle_build ] | |
uses: ./.github/workflows/sub_jacoco_report.yml | |
essential_tests: | |
needs: [ gradle_build ] | |
uses: ./.github/workflows/sub_essential_tests.yml | |
extended_tests: | |
needs: [ gradle_build ] | |
uses: ./.github/workflows/sub_extended_tests.yml | |
codeql_analysis: | |
uses: ./.github/workflows/sub_codeql_analysis.yml | |
build_and_push_docker_image: | |
name: Push to DockerHub | |
needs: [ gradle_build, essential_tests, extended_tests, codeql_analysis ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@bb984efc561711aaa26e433c32c3521176eae55b | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Get current date | |
id: get_date | |
run: echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
- name: Calculate Github SHA | |
shell: bash | |
id: get_sha | |
run: echo "SHA=$(git rev-parse --short ${{ github.sha }} )" >> $GITHUB_OUTPUT | |
- name: Build and push to DockerHub with tags `edge` and `edge-{date}-{sha}` | |
uses: docker/build-push-action@7f9d37fa544684fb73bfe4835ed7214c255ce02b | |
with: | |
push: true | |
tags: stellar/anchor-platform:edge,stellar/anchor-platform:edge-${{ steps.get_date.outputs.DATE }}-${{ steps.get_sha.outputs.SHA }} | |
file: Dockerfile | |
# TODO: enable purge-image when we got the dockerhub token | |
# purge-image: | |
# name: Purge Docker edge Images (tags=edge-*) | |
# runs-on: ubuntu-22.04 | |
# steps: | |
# - name: Delete image | |
# uses: bots-house/[email protected] | |
# with: | |
# owner: stellarproducteng | |
# name: ${{ secrets.DOCKERHUB_USERNAME }} | |
# token: ${{ secrets.DOCKERHUB_TOKEN }} | |
# tag: edge-* | |
complete: | |
if: always() | |
needs: [ essential_tests, extended_tests, build_and_push_docker_image ] | |
runs-on: ubuntu-latest | |
steps: | |
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') | |
run: exit 1 |