Release #62
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: | |
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 | |
- name: Set Git Config | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
profile: minimal | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
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 ::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: self-hosted , jreleaser_platform: linux-x86_64 } | |
- { target: aarch64-unknown-linux-gnu, os: ubuntu-20.04 , use-cross: true, jreleaser_platform: linux-aarch_64 } | |
runs-on: ${{ matrix.job.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.job.target }} | |
override: true | |
profile: minimal | |
- uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.job.use-cross }} | |
command: build | |
args: --locked --release --target=${{ matrix.job.target }} | |
- name: Assemble | |
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@v3 | |
with: | |
retention-days: 1 | |
name: artifacts | |
path: | | |
out/jreleaser/assemble/sdkman-cli-native/archive/*.zip | |
- name: JReleaser output | |
if: always() | |
uses: actions/upload-artifact@v3 | |
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 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
- name: Release | |
uses: jreleaser/release-action@v2 | |
with: | |
version: latest | |
arguments: release -PartifactsDir=artifacts -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@v3 | |
with: | |
retention-days: 1 | |
name: jreleaser-release | |
path: | | |
out/jreleaser/trace.log | |
out/jreleaser/output.properties | |
- name: Update MongoDB | |
env: | |
MONGO_URL: ${{ secrets.MONGO_URL }} | |
MONGO_USERNAME: ${{ secrets.MONGO_USERNAME }} | |
MONGO_PASSWORD: ${{ secrets.MONGO_PASSWORD }} | |
CARGO_RELEASE_TAG: ${{ needs.prerelease.outputs.VERSION }} | |
run: bin/release-binary.sh "$MONGO_URL" "$MONGO_USERNAME" "$MONGO_PASSWORD" "$CARGO_RELEASE_TAG" |