11 PROJECT_URL: yosql.projects.metio.wtf
15 runs-on: ubuntu-latest
17 commit_count: ${{ steps.commits.outputs.count }}
18 release_version: ${{ steps.release.outputs.version }}
19 previous_version: ${{ steps.previous.outputs.version }}
20 changelog: ${{ steps.changelog.outputs.content }}
21 release_url: ${{ steps.create_release.outputs.upload_url }}
24 name: Clone Git Repository
25 uses: actions/checkout@v2
27 fetch-depth: 0 # required in order to get all tags
30 run: echo "::set-output name=count::$(git rev-list --count HEAD --since='last Wednesday' -- yosql-codegen yosql-converters yosql-dao yosql-internals yosql-logging yosql-models yosql-testing yosql-tooling)"
32 name: Create Release Version
33 if: steps.commits.outputs.count > 0
34 run: echo "::set-output name=version::$(date +'%Y.%-m.%-d')"
36 name: Get Last Release
37 if: steps.commits.outputs.count > 0
38 run: echo "::set-output name=version::$(git describe --abbrev=0 --tags)"
39 - id: generate_changelog
40 name: Generate Changelog
41 if: steps.commits.outputs.count > 0
42 uses: heinrichreimer/github-changelog-generator-action@v2.2
44 token: ${{ secrets.GITHUB_TOKEN }}
50 filterByMilestone: false
51 futureRelease: ${{ steps.release.outputs.version }}
52 sinceTag: ${{ steps.previous.outputs.version }}
53 stripGeneratorNotice: true
55 - name: Check Changelog Existence
57 uses: andstor/file-existence-action@v1
60 - name: Create Empty Changelog
62 uses: 1arp/create-a-file-action@0.2
63 if: steps.check_changelog.outputs.files_exists == 'false'
67 no user facing changes
68 - name: Read Changelog
70 uses: juliangruber/read-file-action@v1
75 if: steps.commits.outputs.count > 0
76 uses: actions/create-release@v1
78 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80 tag_name: ${{ steps.release.outputs.version }}
81 release_name: ${{ steps.release.outputs.version }}
86 Write more SQL! Take a look at the [website](https://${{ env.PROJECT_URL }}/) for detailed information. **This release requires at least Java ${{ env.JAVA_VERSION }}** at build time.
88 ${{ steps.changelog.outputs.content }}
90 name: Deploy Artifacts
91 runs-on: ubuntu-latest
95 name: Clone Git Repository
96 uses: actions/checkout@v2
97 if: needs.prepare.outputs.commit_count > 0
100 uses: actions/setup-java@v2
101 if: needs.prepare.outputs.commit_count > 0
103 java-version: ${{ env.JAVA_VERSION }}
104 java-package: ${{ env.JAVA_PACKAGE }}
105 architecture: ${{ env.JAVA_ARCH }}
106 distribution: ${{ env.JAVA_DISTRO }}
108 server-username: MAVEN_CENTRAL_USERNAME
109 server-password: MAVEN_CENTRAL_TOKEN
111 name: Cache Maven Repository
112 uses: actions/cache@v2.1.5
113 if: needs.prepare.outputs.commit_count > 0
115 path: ~/.m2/repository
116 key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
118 ${{ runner.os }}-maven-
121 run: echo "${{ secrets.GPG_SECRET_KEY_BASE64 }}" | base64 --decode > $GITHUB_WORKSPACE/signing.key.asc
122 - name: Set release version
123 run: mvn --batch-mode versions:set -DnewVersion=${{ needs.prepare.outputs.release_version }} -DgenerateBackupPoms=false
124 if: needs.prepare.outputs.commit_count > 0
126 name: Deploy Maven Artifacts
127 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 -Dpgp.secretkey=keyfile:$GITHUB_WORKSPACE/signing.key.asc -Dpgp.passphrase=literal:${{ secrets.GPG_SECRET_KEY_PASSWORD }}
128 if: needs.prepare.outputs.commit_count > 0
130 MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
131 MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
133 name: Deploy Gradle Plugin
134 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 }}
135 if: needs.prepare.outputs.commit_count > 0
138 runs-on: ubuntu-latest
139 needs: [prepare, deploy]
142 benchmark: [codegen, jdbc]
145 name: Clone Git Repository
146 uses: actions/checkout@v2
147 if: needs.prepare.outputs.commit_count > 0
150 uses: actions/setup-java@v2
151 if: needs.prepare.outputs.commit_count > 0
153 java-version: ${{ env.JAVA_VERSION }}
154 java-package: ${{ env.JAVA_PACKAGE }}
155 architecture: ${{ env.JAVA_ARCH }}
156 distribution: ${{ env.JAVA_DISTRO }}
158 name: Cache Maven Repository
159 uses: actions/cache@v2.1.5
160 if: needs.prepare.outputs.commit_count > 0
162 path: ~/.m2/repository
163 key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
165 ${{ runner.os }}-maven-
167 name: Run Benchmark [${{ matrix.benchmark }}]
168 run: mvn --batch-mode --projects yosql-benchmarks/yosql-benchmarks-${{ matrix.benchmark }} --also-make --activate-profiles benchmarks verify -Dorg.slf4j.simpleLogger.log.yosql=warn -DskipTests 2>&1 1> build.log
169 if: needs.prepare.outputs.commit_count > 0
171 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
172 - id: upload-benchmark
173 name: Upload Benchmark Results
174 uses: actions/upload-artifact@v2
175 if: needs.prepare.outputs.commit_count > 0
177 name: benchmark-${{ matrix.benchmark }}
178 path: ./yosql-benchmarks/yosql-benchmarks-${{ matrix.benchmark }}/target/benchmark/yosql-benchmarks-${{ matrix.benchmark }}.json
180 name: Publish Results
181 runs-on: ubuntu-latest
182 needs: [prepare, benchmarks]
185 name: Clone Git Repository
186 uses: actions/checkout@v2
187 if: needs.prepare.outputs.commit_count > 0
189 name: Download Benchmarks Results
190 uses: actions/download-artifact@v2
191 if: needs.prepare.outputs.commit_count > 0
192 - id: copy-codegen-results
193 name: Copy Codegen Results
194 run: cp ./benchmark-codegen/yosql-benchmarks-codegen.json ./yosql-website/content/benchmarks/releases/yosql-benchmarks-codegen-${{ needs.prepare.outputs.release_version }}.json
195 if: needs.prepare.outputs.commit_count > 0
196 - id: copy-jdbc-results
197 name: Copy JDBC Results
198 run: cp ./benchmark-jdbc/yosql-benchmarks-jdbc.json ./yosql-website/content/benchmarks/releases/yosql-benchmarks-jdbc-${{ needs.prepare.outputs.release_version }}.json
199 if: needs.prepare.outputs.commit_count > 0
201 name: Push Benchmarks
202 uses: stefanzweifel/git-auto-commit-action@v4
203 if: needs.prepare.outputs.commit_count > 0
205 commit_message: Add benchmark results for ${{ needs.prepare.outputs.release_version }}
206 file_pattern: "*.json"
208 name: Send Announcements
209 needs: [prepare, results]
210 runs-on: ubuntu-latest
214 uses: dawidd6/action-send-mail@v2
215 if: needs.prepare.outputs.commit_count > 0
217 server_address: ${{ secrets.MAIL_SERVER }}
218 server_port: ${{ secrets.MAIL_PORT }}
219 username: ${{ secrets.MAIL_USERNAME }}
220 password: ${{ secrets.MAIL_PASSWORD }}
221 to: ${{ secrets.MAIL_TO }}
222 from: ${{ secrets.MAIL_SENDER }}
223 subject: release ${{ needs.prepare.outputs.release_version }}
224 body: See https://github.com/metio/yosql/releases/tag/${{ needs.prepare.outputs.release_version }} for details.
226 name: Send Matrix Message
227 uses: s3krit/matrix-message-action@v0.0.3
228 if: needs.prepare.outputs.commit_count > 0
230 access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
231 room_id: ${{ secrets.MATRIX_ROOM_ID }}
232 server: ${{ secrets.MATRIX_SERVER }}
233 message: release ${{ needs.prepare.outputs.release_version }} published - see https://github.com/metio/yosql/releases/tag/${{ needs.prepare.outputs.release_version }} for details