Release Beta #99
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: Release Beta | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| level: | |
| type: choice | |
| description: "Release level" | |
| required: true | |
| options: | |
| - "patch" | |
| - "minor" | |
| - "major" | |
| default: "patch" | |
| jobs: | |
| prerelease: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| VERSION: ${{ steps.vars.outputs.VERSION }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| ref: master | |
| - name: Set Git Config | |
| run: | | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| - name: Install Rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| profile: minimal | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@v2.7.0 | |
| with: | |
| cache-targets: "false" | |
| - name: Cargo install cargo-release | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: install | |
| args: cargo-release | |
| - name: Perform Cargo release | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: release | |
| args: ${{ github.event.inputs.level }} --execute --no-confirm | |
| - name: Version | |
| id: vars | |
| shell: bash | |
| run: | | |
| version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1) | |
| echo "Setting VERSION to $version" | |
| echo ::set-output name=VERSION::$(echo "$version") | |
| build: | |
| needs: [ prerelease ] | |
| name: 'Build ${{ matrix.job.target }}' | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| job: | |
| - {target: aarch64-apple-darwin, os: macos-latest, jreleaser_platform: osx-aarch_64} | |
| - {target: x86_64-apple-darwin, os: macos-latest, jreleaser_platform: osx-x86_64} | |
| - {target: x86_64-pc-windows-msvc, os: windows-latest, jreleaser_platform: windows-x86_64} | |
| - {target: x86_64-unknown-linux-gnu, os: ubuntu-latest, container: 'ubuntu:20.04', jreleaser_platform: linux-x86_64} | |
| - {target: i686-unknown-linux-gnu, os: ubuntu-latest, container: 'ubuntu:20.04', jreleaser_platform: linux-x86_32} | |
| - {target: aarch64-unknown-linux-gnu, os: ubuntu-latest, container: 'ubuntu:20.04', jreleaser_platform: linux-aarch_64} | |
| runs-on: ${{ matrix.job.os }} | |
| container: | |
| image: ${{ matrix.job.container }} | |
| options: --privileged | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| ref: master | |
| - name: Install dependencies (Linux containers) | |
| if: matrix.job.container | |
| run: | | |
| apt-get update | |
| apt-get install -y curl build-essential zip unzip | |
| - name: Install Rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| target: ${{ matrix.job.target }} | |
| override: true | |
| profile: minimal | |
| - name: Setup cross-compilation toolchain | |
| if: matrix.job.container | |
| uses: taiki-e/setup-cross-toolchain-action@v1 | |
| with: | |
| target: ${{ matrix.job.target }} | |
| - name: Install SDKMAN and JReleaser (Linux containers) | |
| if: matrix.job.container | |
| shell: bash | |
| run: | | |
| curl -s "https://get.sdkman.io" | bash | |
| source ~/.sdkman/bin/sdkman-init.sh | |
| sdk install java 17.0.2-tem | |
| sdk install jreleaser | |
| - name: Build | |
| uses: actions-rs/cargo@v1 | |
| with: | |
| command: build | |
| args: --locked --release --target=${{ matrix.job.target }} | |
| - name: Assemble (Linux containers) | |
| if: matrix.job.container | |
| shell: bash | |
| run: | | |
| source ~/.sdkman/bin/sdkman-init.sh | |
| jreleaser assemble | |
| env: | |
| JRELEASER_PROJECT_VERSION: ${{ needs.prerelease.outputs.VERSION }} | |
| JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| JRELEASER_PLATFORM_OVERRIDE: ${{ matrix.job.jreleaser_platform }} | |
| - name: Assemble (Non-Linux) | |
| if: '!matrix.job.container' | |
| uses: jreleaser/release-action@v2 | |
| with: | |
| version: latest | |
| arguments: assemble | |
| env: | |
| JRELEASER_PROJECT_VERSION: ${{ needs.prerelease.outputs.VERSION }} | |
| JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| JRELEASER_PLATFORM_OVERRIDE: ${{ matrix.job.jreleaser_platform }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| retention-days: 1 | |
| name: artifacts-${{ matrix.job.target }} | |
| path: | | |
| out/jreleaser/assemble/sdkman-cli-native/archive/*.zip | |
| - name: JReleaser output | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| retention-days: 1 | |
| name: jreleaser-${{ matrix.job.target }} | |
| path: | | |
| out/jreleaser/trace.log | |
| out/jreleaser/output.properties | |
| release: | |
| needs: [ prerelease, build ] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| ref: master | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Release | |
| uses: jreleaser/release-action@v2 | |
| with: | |
| version: latest | |
| arguments: release -PskipArchiveResolver | |
| env: | |
| JRELEASER_PROJECT_VERSION: ${{ needs.prerelease.outputs.VERSION }} | |
| JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| JRELEASER_SKIP_TAG: true | |
| JRELEASER_TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }} | |
| JRELEASER_TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_API_SECRET }} | |
| JRELEASER_TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} | |
| JRELEASER_TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} | |
| JRELEASER_MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN}} | |
| - name: JReleaser output | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| retention-days: 1 | |
| name: jreleaser-release-${{ matrix.job.target }} | |
| path: | | |
| out/jreleaser/trace.log | |
| out/jreleaser/output.properties | |
| - name: Update MongoDB (Beta) | |
| env: | |
| MONGO_URL: ${{ secrets.MONGO_URL }} | |
| MONGO_USERNAME: ${{ secrets.MONGO_USERNAME }} | |
| MONGO_PASSWORD: ${{ secrets.MONGO_PASSWORD }} | |
| RELEASE_VERSION: ${{ needs.prerelease.outputs.VERSION }} | |
| run: bin/release-binary.sh "$MONGO_URL" "$MONGO_USERNAME" "$MONGO_PASSWORD" "$RELEASE_VERSION" "beta" |