Bump up to 0.15.0 #120
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" | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
group: release-chatgpt-java-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-artifacts: | |
name: Build Artifacts | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
matrix: | |
os: [ ubuntu, macos, windows ] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: graalvm/setup-graalvm@v1 | |
with: | |
version: '22.3.1' | |
java-version: '17' | |
cache: 'gradle' | |
components: 'native-image' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Assets | |
run: ./gradlew --no-daemon nativeCompile --parallel | |
- name: Upload Assets | |
uses: actions/upload-artifact@v3 | |
with: | |
name: chatgpt-cli-${{ matrix.os }} | |
path: chatgpt-cli/build/native/nativeCompile/* | |
upload-release: | |
if: startsWith(github.ref, 'refs/tags/') | |
name: Upload Release Assets | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [ ubuntu, macos, windows ] | |
needs: | |
- build-artifacts | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: chatgpt-cli-${{ matrix.os }} | |
path: chatgpt-cli-${{ matrix.os }} | |
- name: Rename Artifacts | |
run: | | |
mv chatgpt-cli-${{ matrix.os }}/chatgpt-cli chatgpt-cli.${{ matrix.os }} || true | |
mv chatgpt-cli-${{ matrix.os }}/chatgpt-cli.exe chatgpt-cli.${{ matrix.os }}.exe || true | |
- name: Upload | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
chatgpt-cli.${{ matrix.os }} | |
chatgpt-cli.${{ matrix.os }}.exe | |
push-docker: | |
if: startsWith(github.ref, 'refs/tags/') | |
name: Publish Docker Image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
matrix: | |
registry: | |
- url: ghcr.io/kezhenxu94/chatgpt-java | |
username: ${{ github.actor }} | |
password: GITHUB_TOKEN | |
- url: docker.io/kezhenxu94 | |
username: kezhenxu94 | |
password: DOCKER_TOKEN | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: graalvm/setup-graalvm@v1 | |
with: | |
version: '22.3.1' | |
java-version: '17' | |
cache: 'gradle' | |
components: 'native-image' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish Docker Image | |
env: | |
DOCKER_REGISTRY: ${{ matrix.registry.url }} | |
DOCKER_USERNAME: ${{ matrix.registry.username }} | |
DOCKER_PASSWORD: ${{ secrets[matrix.registry.password] }} | |
run: | | |
./gradlew --no-daemon \ | |
bootBuildImage \ | |
--publishImage \ | |
--parallel | |
publish-maven-packages: | |
if: startsWith(github.ref, 'refs/tags/') | |
name: Publish Maven Packages | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: graalvm/setup-graalvm@v1 | |
with: | |
version: '22.3.1' | |
java-version: '17' | |
cache: 'gradle' | |
components: 'native-image' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish Maven Packages | |
env: | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
MAVEN_SIGNING_KEY: ${{ secrets.MAVEN_SIGNING_KEY }} | |
MAVEN_SIGNING_PASSWORD: ${{ secrets.MAVEN_SIGNING_PASSWORD }} | |
run: ./gradlew --no-daemon publish |