-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport to branch(3.7) : Split release.yaml to two sub workflows (#1264
) Co-authored-by: Satoshi Hikida <[email protected]>
- Loading branch information
Showing
3 changed files
with
216 additions
and
112 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Create release | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
secrets: | ||
GH_PROJECT_ACCESS_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
create-release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set version | ||
id: version | ||
run: | | ||
VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/v##g") | ||
echo "version=${VERSION}" >> $GITHUB_OUTPUT | ||
- name: Set up JDK 8 and 11 (default 8) | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: | | ||
11 | ||
8 | ||
- name: Checkout release note scripts | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: scalar-labs/actions | ||
token: ${{ secrets.GH_PROJECT_ACCESS_TOKEN }} | ||
path: ${{ github.workspace }} | ||
sparse-checkout-cone-mode: false | ||
sparse-checkout: | | ||
release-note-script/src/main/java | ||
- name: Move scripts to the working directory | ||
run: cp ${{ github.workspace }}/release-note-script/src/main/java/* ${{ github.workspace }} | ||
|
||
- name: Create release note body | ||
id: rn_body | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_PROJECT_ACCESS_TOKEN }} | ||
run: | | ||
$JAVA_HOME_11_X64/bin/java ReleaseNoteCreation.java ${{ github.repository_owner }} ScalarDB ${{ steps.version.outputs.version }} ${{ github.event.repository.name }} > rnbody.md | ||
cat rnbody.md | ||
- name: Create release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_PROJECT_ACCESS_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
body_path: rnbody.md | ||
draft: true | ||
prerelease: false | ||
|
||
- name: Checkout the current repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build scalardb-server zip | ||
run: ./gradlew :server:distZip | ||
|
||
- name: Upload scalardb-server zip | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_PROJECT_ACCESS_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: server/build/distributions/scalardb-server-${{ steps.version.outputs.version }}.zip | ||
asset_name: scalardb-server-${{ steps.version.outputs.version }}.zip | ||
asset_content_type: application/zip | ||
|
||
- name: Build scalardb-schema-loader jar | ||
run: ./gradlew :schema-loader:shadowJar | ||
|
||
- name: Upload scalardb-schema-loader jar | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_PROJECT_ACCESS_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: schema-loader/build/libs/scalardb-schema-loader-${{ steps.version.outputs.version }}.jar | ||
asset_name: scalardb-schema-loader-${{ steps.version.outputs.version }}.jar | ||
asset_content_type: application/java-archive |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: Upload artifacts | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
secrets: | ||
CR_PAT: | ||
required: true | ||
ACR_LOGIN_SERVER: | ||
required: true | ||
ACR_USER: | ||
required: true | ||
ACR_PASSWORD: | ||
required: true | ||
AWS_MARKETPLACE_ROLE_OIDC: | ||
required: true | ||
AWS_MARKETPLACE_ECR_ID: | ||
required: true | ||
SIGNING_SECRET_KEY_RING: | ||
required: true | ||
SIGNING_KEY_ID: | ||
required: true | ||
SIGNING_PASSWORD: | ||
required: true | ||
OSSRH_USERNAMAE: | ||
required: true | ||
OSSRH_PASSWORD: | ||
required: true | ||
|
||
jobs: | ||
upload-artifacts: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set version | ||
id: version | ||
run: | | ||
VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/v##g") | ||
echo "version=${VERSION}" >> $GITHUB_OUTPUT | ||
MINOR_VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/v##g" | grep -o -E "^[0-9]+\.[0-9]+") | ||
echo "minor_version=${MINOR_VERSION}" >> $GITHUB_OUTPUT | ||
LATEST_VERSION=$(curl -s -u "${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/scalar-labs/scalardb/tags | jq -r .[].name | sort --version-sort -r | head -n 1 | sed -e "s#v##g") | ||
echo "latest_version=${LATEST_VERSION}" >> $GITHUB_OUTPUT | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '8' | ||
distribution: 'temurin' | ||
|
||
- name: Cache Gradle packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.CR_PAT }} | ||
|
||
- name: Login to Azure Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ secrets.ACR_LOGIN_SERVER }} | ||
username: ${{ secrets.ACR_USER }} | ||
password: ${{ secrets.ACR_PASSWORD }} | ||
|
||
- name: Create containers | ||
run: ./gradlew docker | ||
|
||
- name: Push containers | ||
run: | | ||
docker push ghcr.io/scalar-labs/scalardb-server:${{ steps.version.outputs.version }} | ||
docker push ghcr.io/scalar-labs/scalardb-schema-loader:${{ steps.version.outputs.version }} | ||
- name: Push containers to Azure Container Registry | ||
run: | | ||
docker tag ghcr.io/scalar-labs/scalardb-server:${{ steps.version.outputs.version }} ${{ secrets.ACR_LOGIN_SERVER }}/scalardb-server:${{ steps.version.outputs.version }} | ||
docker tag ghcr.io/scalar-labs/scalardb-server:${{ steps.version.outputs.version }} ${{ secrets.ACR_LOGIN_SERVER }}/scalardb-server:${{ steps.version.outputs.minor_version }} | ||
docker push ${{ secrets.ACR_LOGIN_SERVER }}/scalardb-server:${{ steps.version.outputs.version }} | ||
docker push ${{ secrets.ACR_LOGIN_SERVER }}/scalardb-server:${{ steps.version.outputs.minor_version }} | ||
- name: Push latest tag to Azure Container Registry | ||
if: ${{ steps.version.outputs.version == steps.version.outputs.latest_version }} | ||
run: | | ||
docker tag ghcr.io/scalar-labs/scalardb-server:${{ steps.version.outputs.version }} ${{ secrets.ACR_LOGIN_SERVER }}/scalardb-server:latest | ||
docker push ${{ secrets.ACR_LOGIN_SERVER }}/scalardb-server:latest | ||
- name: Upload scalardb, scalardb-server, scalardb-rpc, and scalardb-schema-loader to Maven Central Repository | ||
run: | | ||
echo "${{secrets.SIGNING_SECRET_KEY_RING}}" | base64 -d > ~/.gradle/secring.gpg | ||
./gradlew publish \ | ||
-Psigning.keyId="${{ secrets.SIGNING_KEY_ID }}" \ | ||
-P'signing.password'="${{ secrets.SIGNING_PASSWORD }}" \ | ||
-Psigning.secretKeyRingFile="$(echo ~/.gradle/secring.gpg)" \ | ||
-PossrhUsername="${{ secrets.OSSRH_USERNAMAE }}" \ | ||
-PossrhPassword="${{ secrets.OSSRH_PASSWORD }}" |