CD #16
This file contains hidden or 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: CD | |
| on: | |
| # 输入version | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'version number' | |
| required: true | |
| default: '0.1.0' | |
| jobs: | |
| build_and_push: | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| platform: | |
| - os: ubuntu-latest | |
| artifact_os_name: linux | |
| - os: macos-latest | |
| artifact_os_name: macos | |
| - os: windows-latest | |
| artifact_os_name: windows | |
| runs-on: ${{ matrix.platform.os }} | |
| permissions: | |
| contents: write | |
| outputs: | |
| version: ${{ inputs.version }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - uses: coursier/cache-action@v6 | |
| - uses: coursier/setup-action@v1 | |
| with: | |
| jvm: temurin:21 | |
| apps: sbt bloop sbtn | |
| - name: Run SBT stage | |
| run: sbt clean stage | |
| - name: package | |
| run: jpackage --name log-http-proxy --input target/universal/stage/lib --main-jar log-http-proxy.log-http-proxy-${{ inputs.version }}.jar --main-class Main --type app-image | |
| - name: Upload macOS artifact | |
| if: matrix.platform.artifact_os_name == 'macos' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: log-http-proxy-${{ matrix.platform.artifact_os_name }}-${{ inputs.version }} | |
| path: log-http-proxy.app | |
| if-no-files-found: error | |
| - name: Upload Linux/Windows artifact | |
| if: matrix.platform.artifact_os_name != 'macos' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: log-http-proxy-${{ matrix.platform.artifact_os_name }}-${{ inputs.version }} | |
| path: log-http-proxy | |
| if-no-files-found: error | |
| create_release: | |
| needs: build_and_push | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| - name: Compress Artifacts | |
| run: | | |
| mkdir -p compressed_artifacts | |
| cd artifacts | |
| zip -r ../compressed_artifacts/log-http-proxy-macos-${{ needs.build_and_push.outputs.version }}.zip log-http-proxy-macos-* | |
| zip -r ../compressed_artifacts/log-http-proxy-linux-${{ needs.build_and_push.outputs.version }}.zip log-http-proxy-linux-* | |
| zip -r ../compressed_artifacts/log-http-proxy-windows-${{ needs.build_and_push.outputs.version }}.zip log-http-proxy-windows-* | |
| - name: Create Draft Release and Upload Assets | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ needs.build_and_push.outputs.version }} | |
| name: Release v${{ needs.build_and_push.outputs.version }} | |
| draft: true | |
| prerelease: false | |
| files: | | |
| compressed_artifacts/** |