CD #9
Workflow file for this run
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: ubuntu | |
| - 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 https-proxy --input target/universal/stage/lib --main-jar https-proxy.https-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: https-proxy-${{ matrix.platform.artifact_os_name }}-${{ inputs.version }} | |
| path: https-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: https-proxy-${{ matrix.platform.artifact_os_name }}-${{ inputs.version }} | |
| path: https-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/https-proxy-macos-${{ needs.build_and_push.outputs.version }}.zip https-proxy-macos-* | |
| zip -r ../compressed_artifacts/https-proxy-ubuntu-${{ needs.build_and_push.outputs.version }}.zip https-proxy-ubuntu-* | |
| zip -r ../compressed_artifacts/https-proxy-windows-${{ needs.build_and_push.outputs.version }}.zip https-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/** |