Skip to content
name: Build and publish the release to GitHub releases and PyPi
on:
pull_request:
types:
- closed
branches:
- main
jobs:
build-release:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Build with Maven
run: mvn package -DskipTests -DcompressZip=true -Pbuild-with-jdk-11 -Prun-npm
- uses: juliangruber/read-file-action@v1
name: Read VERSION
id: read_version
with:
path: ./VERSION
- uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.RELEASES_SERVICE_ACCOUNT_JSON }}
- id: 'upload-release-asia'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: './distribution/target/dqo-distribution-${{steps.read_version.outputs.content}}-bin.zip'
destination: '${{ secrets.DQOPS_COM_WWW_BUCKET_PREFIX }}-asia/releases'
gzip: false
process_gcloudignore: false
headers: |-
content-type: application/zip
- id: 'upload-release-australia-southeast1'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: './distribution/target/dqo-distribution-${{steps.read_version.outputs.content}}-bin.zip'
destination: '${{ secrets.DQOPS_COM_WWW_BUCKET_PREFIX }}-australia-southeast1/releases'
gzip: false
process_gcloudignore: false
headers: |-
content-type: application/zip
- id: 'upload-release-eu'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: './distribution/target/dqo-distribution-${{steps.read_version.outputs.content}}-bin.zip'
destination: '${{ secrets.DQOPS_COM_WWW_BUCKET_PREFIX }}-eu/releases'
gzip: false
process_gcloudignore: false
headers: |-
content-type: application/zip
- id: 'upload-release-europe-central2'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: './distribution/target/dqo-distribution-${{steps.read_version.outputs.content}}-bin.zip'
destination: '${{ secrets.DQOPS_COM_WWW_BUCKET_PREFIX }}-europe-central2/releases'
gzip: false
process_gcloudignore: false
headers: |-
content-type: application/zip
- id: 'upload-release-in'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: './distribution/target/dqo-distribution-${{steps.read_version.outputs.content}}-bin.zip'
destination: '${{ secrets.DQOPS_COM_WWW_BUCKET_PREFIX }}-in/releases'
gzip: false
process_gcloudignore: false
headers: |-
content-type: application/zip
- id: 'upload-release-me-central1'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: './distribution/target/dqo-distribution-${{steps.read_version.outputs.content}}-bin.zip'
destination: '${{ secrets.DQOPS_COM_WWW_BUCKET_PREFIX }}-me-central1/releases'
gzip: false
process_gcloudignore: false
headers: |-
content-type: application/zip
- id: 'upload-release-me-west1'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: './distribution/target/dqo-distribution-${{steps.read_version.outputs.content}}-bin.zip'
destination: '${{ secrets.DQOPS_COM_WWW_BUCKET_PREFIX }}-me-west1/releases'
gzip: false
process_gcloudignore: false
headers: |-
content-type: application/zip
- id: 'upload-release-southamerica-east1'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: './distribution/target/dqo-distribution-${{steps.read_version.outputs.content}}-bin.zip'
destination: '${{ secrets.DQOPS_COM_WWW_BUCKET_PREFIX }}-southamerica-east1/releases'
gzip: false
process_gcloudignore: false
headers: |-
content-type: application/zip
- id: 'upload-release-africa-south1'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: './distribution/target/dqo-distribution-${{steps.read_version.outputs.content}}-bin.zip'
destination: '${{ secrets.DQOPS_COM_WWW_BUCKET_PREFIX }}-africa-south1/releases'
gzip: false
process_gcloudignore: false
headers: |-
content-type: application/zip
- id: 'upload-release-us'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: './distribution/target/dqo-distribution-${{steps.read_version.outputs.content}}-bin.zip'
destination: '${{ secrets.DQOPS_COM_WWW_BUCKET_PREFIX }}-us/releases'
gzip: false
process_gcloudignore: false
headers: |-
content-type: application/zip
- uses: docker-practice/actions-setup-docker@master
- uses: mr-smithers-excellent/docker-build-push@v6
name: Build and Push Docker Image
with:
image: dqops/dqo
tags: ${{ steps.read_version.outputs.content }},latest
dockerfile: Dockerfile-fast
enableBuildKit: true
multiPlatform: true
platform: linux/amd64,linux/arm64
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create GitHub release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: v${{ steps.read_version.outputs.content }}
tag_name: v${{ steps.read_version.outputs.content }}
body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload distribution binary file
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./distribution/target/dqo-distribution-${{steps.read_version.outputs.content}}-bin.zip
asset_name: dqo-distribution-${{steps.read_version.outputs.content}}-bin.zip
asset_content_type: application/zip
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./distribution/python/requirements.txt
- name: Build PyPi package
run: |
python -m build ./distribution/python
- name: Publish PyPi package
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: distribution/python/dist/
user: __token__
password: ${{ secrets.PYPI_TOKEN }}