Create release #3
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: Create release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| commit_hash: | |
| description: "Hash of 'Release version x.y.z' commit" | |
| required: true | |
| jobs: | |
| build: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Setup Java SDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 17 | |
| distribution: temurin | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.commit_hash }} | |
| - name: Check commit title and extract version | |
| env: | |
| COMMIT_HASH: ${{ github.event.inputs.commit_hash }} | |
| run: | | |
| export commit_title=$(git log --pretty=format:%s -1 $COMMIT_HASH) | |
| echo "Commit title: $commit_title" | |
| if [[ $commit_title =~ ^Release\ version\ [0-9]*\.[0-9]*\.[0-9]*$ ]]; then | |
| echo "Valid commit title" | |
| else | |
| echo "Invalid commit title" | |
| exit 1 | |
| fi | |
| export version=$(echo ${commit_title} | sed s/^Release\ version\ //g) | |
| echo "Will use version ${version}" | |
| echo "version=${version}" >> $GITHUB_ENV | |
| - name: Build | |
| run: | | |
| ./gradlew distTar distZip | |
| # Core libs | |
| export core_tar_file=$(ls ./core/build/distributions/ | grep tgz) | |
| export core_zip_file=$(ls ./core/build/distributions/ | grep zip) | |
| echo core_tar_file=${core_tar_file} >> $GITHUB_ENV | |
| echo core_zip_file=${core_zip_file} >> $GITHUB_ENV | |
| # S3 libs | |
| export s3_tar_file=$(ls ./storage/s3/build/distributions/ | grep tgz) | |
| export s3_zip_file=$(ls ./storage/s3/build/distributions/ | grep zip) | |
| echo s3_tar_file=${s3_tar_file} >> $GITHUB_ENV | |
| echo s3_zip_file=${s3_zip_file} >> $GITHUB_ENV | |
| # GCS libs | |
| export gcs_tar_file=$(ls ./storage/gcs/build/distributions/ | grep tgz) | |
| export gcs_zip_file=$(ls ./storage/gcs/build/distributions/ | grep zip) | |
| echo gcs_tar_file=${gcs_tar_file} >> $GITHUB_ENV | |
| echo gcs_zip_file=${gcs_zip_file} >> $GITHUB_ENV | |
| # Azure libs | |
| export azure_tar_file=$(ls ./storage/azure/build/distributions/ | grep tgz) | |
| export azure_zip_file=$(ls ./storage/azure/build/distributions/ | grep zip) | |
| echo azure_tar_file=${azure_tar_file} >> $GITHUB_ENV | |
| echo azure_zip_file=${azure_zip_file} >> $GITHUB_ENV | |
| # Filesystem libs | |
| export fs_tar_file=$(ls ./storage/filesystem/build/distributions/ | grep tgz) | |
| export fs_zip_file=$(ls ./storage/filesystem/build/distributions/ | grep zip) | |
| echo fs_tar_file=${fs_tar_file} >> $GITHUB_ENV | |
| echo fs_zip_file=${fs_zip_file} >> $GITHUB_ENV | |
| echo core_tar_path=`realpath ./core/build/distributions/${core_tar_file}` >> $GITHUB_ENV | |
| echo core_zip_path=`realpath ./core/build/distributions/${core_zip_file}` >> $GITHUB_ENV | |
| echo s3_tar_path=`realpath ./storage/s3/build/distributions/${s3_tar_file}` >> $GITHUB_ENV | |
| echo s3_zip_path=`realpath ./storage/s3/build/distributions/${s3_zip_file}` >> $GITHUB_ENV | |
| echo gcs_tar_path=`realpath ./storage/gcs/build/distributions/${gcs_tar_file}` >> $GITHUB_ENV | |
| echo gcs_zip_path=`realpath ./storage/gcs/build/distributions/${gcs_zip_file}` >> $GITHUB_ENV | |
| echo azure_tar_path=`realpath ./storage/azure/build/distributions/${azure_tar_file}` >> $GITHUB_ENV | |
| echo azure_zip_path=`realpath ./storage/azure/build/distributions/${azure_zip_file}` >> $GITHUB_ENV | |
| echo fs_tar_path=`realpath ./storage/filesystem/build/distributions/${fs_tar_file}` >> $GITHUB_ENV | |
| echo fs_zip_path=`realpath ./storage/filesystem/build/distributions/${fs_zip_file}` >> $GITHUB_ENV | |
| - name: Create tag | |
| env: | |
| VERSION: ${{ env.version }} | |
| run: | | |
| git config --local user.name "GitHub Action" | |
| git config --local user.email "[email protected]" | |
| git tag -a "v$VERSION" -m "Release version $VERSION" | |
| git push origin "v$VERSION" | |
| - name: Create release draft | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: "v${{ env.version }}" | |
| release_name: "v${{ env.version }}" | |
| commitish: ${{ github.event.inputs.commit_hash }} | |
| body: | | |
| *Fill in* | |
| draft: true | |
| prerelease: false | |
| - name: Upload core tar | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{ env.core_tar_path }} | |
| asset_name: ${{ env.core_tar_file }} | |
| asset_content_type: application/tar | |
| - name: Upload core zip | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{ env.core_zip_path }} | |
| asset_name: ${{ env.core_zip_file }} | |
| asset_content_type: application/zip | |
| - name: Upload s3 tar | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{ env.s3_tar_path }} | |
| asset_name: ${{ env.s3_tar_file }} | |
| asset_content_type: application/tar | |
| - name: Upload s3 zip | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{ env.s3_zip_path }} | |
| asset_name: ${{ env.s3_zip_file }} | |
| asset_content_type: application/zip | |
| - name: Upload gcs tar | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{ env.gcs_tar_path }} | |
| asset_name: ${{ env.gcs_tar_file }} | |
| asset_content_type: application/tar | |
| - name: Upload gcs zip | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{ env.gcs_zip_path }} | |
| asset_name: ${{ env.gcs_zip_file }} | |
| asset_content_type: application/zip | |
| - name: Upload azure tar | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{ env.azure_tar_path }} | |
| asset_name: ${{ env.azure_tar_file }} | |
| asset_content_type: application/tar | |
| - name: Upload azure zip | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{ env.azure_zip_path }} | |
| asset_name: ${{ env.azure_zip_file }} | |
| asset_content_type: application/zip | |
| - name: Upload filesystem tar | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{ env.fs_tar_path }} | |
| asset_name: ${{ env.fs_tar_file }} | |
| asset_content_type: application/tar | |
| - name: Upload filesystem zip | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{ env.fs_zip_path }} | |
| asset_name: ${{ env.fs_zip_file }} | |
| asset_content_type: application/zip |