[TH2-5015] updated dev-release workflow (#68) #23
Workflow file for this run
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 and publish Docker distributions to Github Container Registry ghcr.io | |
on: | |
push: | |
tags: | |
- \d+.\d+.\d+-dev | |
jobs: | |
app-version: | |
name: Extract app version | |
uses: th2-net/.github/.github/workflows/compound-prebuild-java-workflow.yml@main | |
with: | |
project-path: . | |
changes: | |
name: Collect changed files | |
runs-on: ubuntu-20.04 | |
outputs: | |
app: ${{ steps.filter.outputs.app }} | |
grpc: ${{ steps.filter.outputs.grpc }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
base: ${{ github.ref }} | |
filters: | | |
app: | |
- 'gradle.properties' | |
grpc: | |
- 'grpc/gradle.properties' | |
grpc-version: | |
name: Extract gRPC version | |
needs: | |
- changes | |
if: ${{ needs.changes.outputs.grpc == 'true' }} | |
uses: th2-net/.github/.github/workflows/compound-prebuild-java-workflow.yml@main | |
with: | |
project-path: grpc | |
build-and-publish-grpc-java: | |
name: Build and publish Java gRPC distributions | |
runs-on: 'ubuntu-20.04' | |
needs: | |
- changes | |
if: ${{ needs.changes.outputs.grpc == 'true' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 'zulu' '11' | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Build with Gradle | |
run: ./gradlew --info -Pversion_suffix='dev' clean build publish closeAndReleaseSonatypeStagingRepository | |
env: | |
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }} | |
build-and-publish-grpc-python: | |
name: Build and publish Python distributions to PyPI | |
needs: | |
- build-and-publish-grpc-java | |
- grpc-version | |
- changes | |
if: ${{ needs.changes.outputs.grpc == 'true' }} | |
uses: th2-net/.github/.github/workflows/compaund-python-grpc-pypi-publication.yml@main | |
with: | |
custom-version: ${{ needs.grpc-version.outputs.version }}rc1 | |
project-path: grpc | |
secrets: | |
pypi_password: ${{ secrets.PYPI_PASSWORD }} | |
owasp-scan: | |
uses: th2-net/.github/.github/workflows/owasp-gradle-scan.yml@main | |
with: | |
multiproject: true | |
publish-docker: | |
name: Build and publish docker image | |
if: | | |
always() && | |
(needs.changes.outputs.app == 'true' || needs.changes.outputs.grpc == 'true') | |
needs: | |
- build-and-publish-grpc-python | |
- build-and-publish-grpc-java | |
- app-version | |
uses: th2-net/.github/.github/workflows/compaund-java-docker-push.yml@main | |
with: | |
docker-username: ${{ github.actor }} | |
version: ${{ needs.app-version.outputs.version }}-dev | |
versionNumber: ${{ needs.app-version.outputs.version }} | |
dockerContext: '.' | |
gradleParameters: '["clean", "build", "dockerPrepare"]' | |
secrets: | |
docker-password: ${{ secrets.GITHUB_TOKEN }} | |
trivy-docker-scan: | |
name: Scan Docker image for vulnerabilities | |
needs: | |
- publish-docker | |
- app-version | |
uses: th2-net/.github/.github/workflows/trivy-scan-github.yml@main | |
with: | |
image-path: ghcr.io/${{ github.repository }}:${{ needs.app-version.outputs.version }}-dev | |
target: 'os,library' | |
sensitivity: 'CRITICAL,HIGH,MEDIUM' |