Merge pull request #519 from kevin-lee/reset-version #332
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: Release | |
on: | |
push: | |
branches: | |
- main | |
- 'logger-f-1' | |
tags: | |
- '*' | |
env: | |
GH_JAVA_VERSION: "11" | |
GH_JAVA_DISTRIBUTION: "temurin" | |
GH_JAVA_OPTS: "-Xss64m -Xms1024m -XX:MaxMetaspaceSize=2G -Xmx4G -XX:MaxInlineLevel=18 -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
scala: | |
- { name: "Scala 2", version: "2.12.13", binary-version: "2.12", java-version: "11", java-distribution: "temurin", report: "" } | |
- { name: "Scala 2", version: "2.13.6", binary-version: "2.13", java-version: "11", java-distribution: "temurin", report: "" } | |
- { name: "Scala 3", version: "3.0.2", binary-version: "3", java-version: "11", java-distribution: "temurin", report: "" } | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.scala.java-version }} | |
distribution: ${{ matrix.scala.java-distribution }} | |
- name: Cache SBT | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.ivy2/cache | |
~/.cache/coursier | |
~/.sbt | |
key: ${{ runner.os }}-sbt-${{ matrix.scala.binary-version }}-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }} | |
restore-keys: | | |
${{ runner.os }}-sbt-${{ matrix.scala.binary-version }}- | |
- name: "[Push] Build All for ${{ matrix.scala.name }}: ${{ matrix.scala.version }} - ${{ github.run_number }}" | |
env: | |
CURRENT_BRANCH_NAME: ${{ github.ref }} | |
RUN_ID: ${{ github.run_id }} | |
RUN_NUMBER: ${{ github.run_number }} | |
JAVA_OPTS: ${{ env.GH_JAVA_OPTS }} | |
run: | | |
echo "[BEFORE]CURRENT_BRANCH_NAME=${CURRENT_BRANCH_NAME}" | |
export CURRENT_BRANCH_NAME="${CURRENT_BRANCH_NAME#refs/heads/}" | |
echo " [AFTER]CURRENT_BRANCH_NAME=${CURRENT_BRANCH_NAME}" | |
echo "RUN_ID=${RUN_ID}" | |
echo "RUN_NUMBER=${RUN_NUMBER}" | |
echo "Push #${PUSH_NUMBER}" | |
echo "JAVA_OPTS=${JAVA_OPTS}" | |
echo "SBT_OPTS=${SBT_OPTS}" | |
java -version | |
sbt \ | |
++${{ matrix.scala.version }}! \ | |
-v \ | |
clean \ | |
test | |
gh-release: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.GH_JAVA_VERSION }} | |
distribution: ${{ env.GH_JAVA_DISTRIBUTION }} | |
- name: Cache SBT | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.ivy2/cache | |
~/.cache/coursier | |
~/.sbt | |
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }} | |
restore-keys: | | |
${{ runner.os }}-sbt | |
- name: sbt GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_AUTH_TOKEN_GITHUB }} | |
JAVA_OPTS: ${{ env.GH_JAVA_OPTS }} | |
run: | | |
echo "Run] sbt GitHub release" | |
echo "JAVA_OPTS=${JAVA_OPTS}" | |
echo "SBT_OPTS=${SBT_OPTS}" | |
echo 'sbt devOopsGitHubRelease' | |
sbt \ | |
-v \ | |
devOopsGitHubRelease | |
publish: | |
needs: gh-release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.GH_JAVA_VERSION }} | |
distribution: ${{ env.GH_JAVA_DISTRIBUTION }} | |
- uses: olafurpg/setup-gpg@v3 | |
- name: Cache SBT | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.ivy2/cache | |
~/.cache/coursier | |
~/.sbt | |
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }} | |
restore-keys: | | |
${{ runner.os }}-sbt | |
- name: "sbt ci-release - ${{ github.run_number }}" | |
if: startsWith(github.ref, 'refs/tags/v') | |
env: | |
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | |
PGP_SECRET: ${{ secrets.PGP_SECRET }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
GITHUB_TOKEN: ${{ secrets.RELEASE_AUTH_TOKEN_GITHUB }} | |
JAVA_OPTS: ${{ env.GH_JAVA_OPTS }} | |
run: | | |
echo "Run] sbt ci-release" | |
export SOURCE_DATE_EPOCH=$(date +%s) | |
echo "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH" | |
echo "JAVA_OPTS=${JAVA_OPTS}" | |
echo "SBT_OPTS=${SBT_OPTS}" | |
echo 'sbt -v clean +packagedArtifacts ci-release' | |
sbt \ | |
-v \ | |
clean \ | |
+packagedArtifacts \ | |
ci-release | |
publish-snapshot: | |
if: startsWith(github.ref, 'refs/heads/') | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.GH_JAVA_VERSION }} | |
distribution: ${{ env.GH_JAVA_DISTRIBUTION }} | |
- uses: olafurpg/setup-gpg@v3 | |
- name: Cache SBT | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.ivy2/cache | |
~/.cache/coursier | |
~/.sbt | |
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }} | |
restore-keys: | | |
${{ runner.os }}-sbt | |
- name: "sbt ci-release (no tag) - ${{ github.run_number }}" | |
if: startsWith(github.ref, 'refs/heads/') | |
env: | |
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | |
PGP_SECRET: ${{ secrets.PGP_SECRET }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
JAVA_OPTS: ${{ env.GH_JAVA_OPTS }} | |
run: | | |
echo "Run] sbt ci-release" | |
export SOURCE_DATE_EPOCH=$(date +%s) | |
echo "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH" | |
echo "JAVA_OPTS=${JAVA_OPTS}" | |
echo "SBT_OPTS=${SBT_OPTS}" | |
sbt \ | |
-v \ | |
clean \ | |
+packagedArtifacts \ | |
ci-release |