Automated Release #157
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: Automated Release | |
on: | |
schedule: | |
- cron: 25 3 * * WED | |
workflow_dispatch: | |
env: | |
JAVA_VERSION: 17 | |
JAVA_PACKAGE: jdk | |
JAVA_ARCH: x64 | |
JAVA_DISTRO: temurin | |
jobs: | |
prepare: | |
name: Prepare Release | |
runs-on: ubuntu-latest | |
outputs: | |
commit_count: ${{ steps.commits.outputs.count }} | |
previous_version: ${{ steps.last_release.outputs.version }} | |
release_version: ${{ steps.release.outputs.version }} | |
steps: | |
- id: checkout | |
name: Clone Git Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- id: last_release | |
name: Fetch last release info | |
run: echo "tag=$(gh release view --json tagName --jq '.tagName')" >> $GITHUB_OUTPUT | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- id: commits | |
name: Count Commits | |
run: echo "count=$(git rev-list --count ${{ steps.last_release.outputs.tag }}..HEAD) -- pom.xml yosql-codegen yosql-internals yosql-models yosql-tooling" >> $GITHUB_OUTPUT | |
- id: release | |
name: Create Release Version | |
if: steps.commits.outputs.count > 0 | |
run: echo "version=$(date +'%Y.%-m.%-d')" >> $GITHUB_OUTPUT | |
- id: timestamp | |
name: Build Timestamp | |
if: steps.commits.outputs.count > 0 | |
run: echo "iso8601=$(date --utc --iso-8601=seconds)" >> $GITHUB_OUTPUT | |
maven: | |
name: Build Maven Tooling | |
needs: prepare | |
runs-on: ubuntu-latest | |
steps: | |
- id: checkout | |
name: Clone Git Repository | |
if: needs.prepare.outputs.commit_count > 0 | |
uses: actions/checkout@v4 | |
- id: java | |
name: Setup Java | |
if: needs.prepare.outputs.commit_count > 0 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
java-package: ${{ env.JAVA_PACKAGE }} | |
architecture: ${{ env.JAVA_ARCH }} | |
distribution: ${{ env.JAVA_DISTRO }} | |
server-id: ossrh | |
server-username: MAVEN_CENTRAL_USERNAME | |
server-password: MAVEN_CENTRAL_TOKEN | |
cache: maven | |
- id: gpg | |
name: GPG Key | |
if: needs.prepare.outputs.commit_count > 0 | |
uses: timheuer/base64-to-file@v1.2 | |
with: | |
fileName: signing.key.asc | |
fileDir: ${{ github.workspace}} | |
encodedString: ${{ secrets.GPG_SECRET_KEY_BASE64 }} | |
- name: Set release version | |
if: needs.prepare.outputs.commit_count > 0 | |
run: mvn --batch-mode versions:set --define newVersion=${{ needs.prepare.outputs.release_version }} --define generateBackupPoms=false | |
- id: deploy-maven-tooling | |
name: Deploy Maven Tooling | |
if: needs.prepare.outputs.commit_count > 0 | |
run: MAVEN_OPTS="--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED" mvn --batch-mode --activate-profiles release --projects yosql-tooling/yosql-tooling-maven --also-make install deploy --define pgp.secretkey=keyfile:signing.key.asc --define pgp.passphrase=literal:${{ secrets.GPG_SECRET_KEY_PASSWORD }} | |
env: | |
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | |
gradle: | |
name: Build Gradle Tooling | |
needs: prepare | |
runs-on: ubuntu-latest | |
steps: | |
- id: checkout | |
name: Clone Git Repository | |
if: needs.prepare.outputs.commit_count > 0 | |
uses: actions/checkout@v4 | |
- id: java | |
name: Setup Java | |
if: needs.prepare.outputs.commit_count > 0 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
java-package: ${{ env.JAVA_PACKAGE }} | |
architecture: ${{ env.JAVA_ARCH }} | |
distribution: ${{ env.JAVA_DISTRO }} | |
cache: maven | |
- name: Set release version | |
if: needs.prepare.outputs.commit_count > 0 | |
run: mvn --batch-mode versions:set --define newVersion=${{ needs.prepare.outputs.release_version }} --define generateBackupPoms=false | |
- id: install-maven-tooling | |
name: Install Maven Tooling | |
if: needs.prepare.outputs.commit_count > 0 | |
run: mvn --batch-mode install | |
- id: build-gradle | |
name: Build Gradle Tooling | |
if: needs.prepare.outputs.commit_count > 0 | |
run: cd ./yosql-examples/yosql-examples-gradle/ && ./gradlew build -Pversion=${{ needs.prepare.outputs.release_version }} | |
- id: deploy-gradle | |
name: Deploy Gradle Tooling | |
if: needs.prepare.outputs.commit_count > 0 | |
run: cd ./yosql-tooling/yosql-tooling-gradle/ && ./gradlew publishPlugins -Pversion=${{ needs.prepare.outputs.release_version }} -Pgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }} -Pgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }} | |
ant: | |
name: Build Ant Tooling | |
needs: prepare | |
runs-on: ubuntu-latest | |
steps: | |
- id: checkout | |
name: Clone Git Repository | |
if: needs.prepare.outputs.commit_count > 0 | |
uses: actions/checkout@v4 | |
- id: java | |
name: Setup Java | |
if: needs.prepare.outputs.commit_count > 0 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
java-package: ${{ env.JAVA_PACKAGE }} | |
architecture: ${{ env.JAVA_ARCH }} | |
distribution: ${{ env.JAVA_DISTRO }} | |
cache: maven | |
- id: gpg | |
name: GPG Key | |
if: needs.prepare.outputs.commit_count > 0 | |
uses: timheuer/base64-to-file@v1.2 | |
with: | |
fileName: signing.key.asc | |
fileDir: ${{ github.workspace}} | |
encodedString: ${{ secrets.GPG_SECRET_KEY_BASE64 }} | |
- name: Set release version | |
if: needs.prepare.outputs.commit_count > 0 | |
run: mvn --batch-mode versions:set --define newVersion=${{ needs.prepare.outputs.release_version }} --define generateBackupPoms=false | |
- id: build-ant-tooling | |
name: Build Ant Tooling | |
if: needs.prepare.outputs.commit_count > 0 | |
run: mvn --batch-mode --activate-profiles release --projects yosql-tooling/yosql-tooling-ant --also-make install --define pgp.secretkey=keyfile:signing.key.asc --define pgp.passphrase=literal:${{ secrets.GPG_SECRET_KEY_PASSWORD }} | |
- id: upload-ant-tooling | |
name: Upload Ant Tooling Artifact | |
if: needs.prepare.outputs.commit_count > 0 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: yosql-tooling-ant | |
path: ./yosql-tooling/yosql-tooling-ant/target/yosql-tooling-ant-*-dist* | |
cli: | |
name: Build CLI Tooling on ${{ matrix.os }} | |
needs: prepare | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
steps: | |
- id: checkout | |
name: Clone Git Repository | |
if: needs.prepare.outputs.commit_count > 0 | |
uses: actions/checkout@v4 | |
- id: graal | |
name: Setup GraalVM | |
if: needs.prepare.outputs.commit_count > 0 | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
distribution: graalvm | |
java-version: ${{ env.JAVA_VERSION }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
cache: maven | |
- id: gpg | |
name: GPG Key | |
if: needs.prepare.outputs.commit_count > 0 | |
uses: timheuer/base64-to-file@v1 | |
with: | |
fileName: signing.key.asc | |
fileDir: ${{ github.workspace}} | |
encodedString: ${{ secrets.GPG_SECRET_KEY_BASE64 }} | |
- name: Set release version | |
if: needs.prepare.outputs.commit_count > 0 | |
run: mvn --batch-mode --define newVersion=${{ needs.prepare.outputs.release_version }} --define generateBackupPoms=false versions:set | |
- id: build-cli-tooling | |
name: Build CLI Tooling | |
if: needs.prepare.outputs.commit_count > 0 | |
run: mvn --batch-mode --activate-profiles release --projects yosql-tooling/yosql-tooling-cli --also-make install --define skipNativeBuild=false --define pgp.secretkey=keyfile:signing.key.asc --define pgp.passphrase=literal:${{ secrets.GPG_SECRET_KEY_PASSWORD }} | |
- id: upload-jvm-cli-tooling | |
name: Upload JVM CLI Tooling | |
if: needs.prepare.outputs.commit_count > 0 && runner.os == 'Linux' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: yosql-tooling-cli-jvm | |
path: ./yosql-tooling/yosql-tooling-cli/target/yosql-tooling-cli-*-jvm* | |
- id: upload-linux-cli-tooling | |
name: Upload Linux CLI Tooling | |
if: needs.prepare.outputs.commit_count > 0 && runner.os == 'Linux' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: yosql-tooling-cli-linux | |
path: ./yosql-tooling/yosql-tooling-cli/target/yosql-tooling-cli-*-linux* | |
- id: upload-mac-cli-tooling | |
name: Upload Mac OSX CLI Tooling | |
if: needs.prepare.outputs.commit_count > 0 && runner.os == 'macOS' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: yosql-tooling-cli-mac | |
path: ./yosql-tooling/yosql-tooling-cli/target/yosql-tooling-cli-*-mac* | |
- id: upload-windows-cli-tooling | |
name: Upload Windows CLI Tooling | |
if: needs.prepare.outputs.commit_count > 0 && runner.os == 'Windows' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: yosql-tooling-cli-windows | |
path: ./yosql-tooling/yosql-tooling-cli/target/yosql-tooling-cli-*-windows* | |
release: | |
name: GitHub Release | |
needs: [prepare, maven, gradle, ant, cli] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- id: checkout | |
name: Clone Git Repository | |
if: needs.prepare.outputs.commit_count > 0 | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- id: download | |
name: Download Artifacts | |
if: needs.prepare.outputs.commit_count > 0 | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- id: create_release | |
name: Create Release | |
if: needs.prepare.outputs.commit_count > 0 | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ needs.prepare.outputs.release_version }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
draft: false | |
prerelease: false | |
generate_release_notes: true | |
files: | | |
artifacts/yosql-tooling-ant/yosql-tooling-ant-${{ needs.prepare.outputs.release_version }}-dist.zip | |
artifacts/yosql-tooling-ant/yosql-tooling-ant-${{ needs.prepare.outputs.release_version }}-dist.zip.asc | |
artifacts/yosql-tooling-ant/yosql-tooling-ant-${{ needs.prepare.outputs.release_version }}-dist.zip.sha512 | |
artifacts/yosql-tooling-cli-jvm/yosql-tooling-cli-${{ needs.prepare.outputs.release_version }}-jvm.zip | |
artifacts/yosql-tooling-cli-jvm/yosql-tooling-cli-${{ needs.prepare.outputs.release_version }}-jvm.zip.asc | |
artifacts/yosql-tooling-cli-jvm/yosql-tooling-cli-${{ needs.prepare.outputs.release_version }}-jvm.zip.sha512 | |
artifacts/yosql-tooling-cli-linux/yosql-tooling-cli-${{ needs.prepare.outputs.release_version }}-linux.zip | |
artifacts/yosql-tooling-cli-linux/yosql-tooling-cli-${{ needs.prepare.outputs.release_version }}-linux.zip.asc | |
artifacts/yosql-tooling-cli-linux/yosql-tooling-cli-${{ needs.prepare.outputs.release_version }}-linux.zip.sha512 | |
artifacts/yosql-tooling-cli-mac/yosql-tooling-cli-${{ needs.prepare.outputs.release_version }}-mac.zip | |
artifacts/yosql-tooling-cli-mac/yosql-tooling-cli-${{ needs.prepare.outputs.release_version }}-mac.zip.asc | |
artifacts/yosql-tooling-cli-mac/yosql-tooling-cli-${{ needs.prepare.outputs.release_version }}-mac.zip.sha512 | |
artifacts/yosql-tooling-cli-linux/yosql-tooling-cli-${{ needs.prepare.outputs.release_version }}-windows.zip | |
artifacts/yosql-tooling-cli-linux/yosql-tooling-cli-${{ needs.prepare.outputs.release_version }}-windows.zip.asc | |
artifacts/yosql-tooling-cli-linux/yosql-tooling-cli-${{ needs.prepare.outputs.release_version }}-windows.zip.sha512 |