center: update styles #100
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*" | |
env: | |
CARGO_TERM_COLOR: always | |
concurrency: | |
group: release-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: build release assets | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
matrix: | |
config: | |
- { | |
os: "ubuntu-latest", | |
arch: "x86_64", | |
extension: "", | |
extraArgs: "", | |
target: "", | |
targetDir: "target/release", | |
} | |
- { | |
os: "ubuntu-latest", | |
arch: "aarch64", | |
extension: "", | |
extraArgs: "--target aarch64-unknown-linux-gnu", | |
target: "aarch64-unknown-linux-gnu", | |
targetDir: "target/aarch64-unknown-linux-gnu/release", | |
} | |
- { | |
os: "macos-latest", | |
arch: "x86_64", | |
extension: "", | |
extraArgs: "", | |
target: "", | |
targetDir: "target/release", | |
} | |
- { | |
os: "macos-latest", | |
arch: "aarch64", | |
extension: "", | |
extraArgs: "--target aarch64-apple-darwin", | |
target: "aarch64-apple-darwin", | |
targetDir: "target/aarch64-apple-darwin/release/", | |
} | |
- { | |
os: "windows-latest", | |
arch: "x86_64", | |
extension: ".exe", | |
extraArgs: "", | |
target: "", | |
targetDir: "target/release", | |
} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: set the release version (tag) | |
if: startsWith(github.ref, 'refs/tags/v') | |
shell: bash | |
run: echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
- name: set the release version (nightly) | |
if: github.ref == 'refs/heads/main' | |
shell: bash | |
run: echo "RELEASE_VERSION=nightly" >> $GITHUB_ENV | |
- name: lowercase the runner OS name | |
shell: bash | |
run: | | |
OS=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]') | |
echo "RUNNER_OS=$OS" >> $GITHUB_ENV | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
default: true | |
target: ${{ matrix.config.target }} | |
- name: setup for cross-compiled linux aarch64 build | |
if: matrix.config.target == 'aarch64-unknown-linux-gnu' | |
run: | | |
sudo apt update | |
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu xz-utils | |
echo '[target.aarch64-unknown-linux-gnu]' >> ${HOME}/.cargo/config.toml | |
echo 'linker = "aarch64-linux-gnu-gcc"' >> ${HOME}/.cargo/config.toml | |
- name: build land-cli | |
shell: bash | |
run: | | |
./deploy/build-cli.sh ${{ matrix.config.arch }} ${{ env.RELEASE_VERSION }} "${{ matrix.config.targetDir }}" "${{ matrix.config.extraArgs }}" | |
- name: upload binary as GitHub artifact | |
if: runner.os != 'Windows' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: land-cli | |
path: _dist/land-cli-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz | |
- name: upload binary as GitHub artifact for windows | |
if: runner.os == 'Windows' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: land-cli | |
path: _dist/land-cli-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.zip | |
- name: upload binary to Github release | |
if: startsWith(github.ref, 'refs/tags/v') && runner.os != 'Windows' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: _dist/land-cli-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz | |
tag: ${{ github.ref }} | |
- name: upload binary to Github release for windows | |
if: startsWith(github.ref, 'refs/tags/v') && runner.os == 'Windows' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: _dist/land-cli-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.zip | |
tag: ${{ github.ref }} | |
update-nightly: | |
name: update nightly release | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Download release assets | |
uses: actions/download-artifact@v3 | |
with: | |
name: land-cli | |
- name: Delete nightly tag | |
uses: dev-drprasad/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: nightly | |
delete_release: true | |
- name: Recreate nightly tag and release | |
uses: rajatjindal/[email protected] | |
with: | |
tag: nightly | |
allowUpdates: true | |
prerelease: true | |
artifacts: "land-cli-nightly*" | |
commit: ${{ github.sha }} | |
body: | | |
This is a "nightly" release of land-cli. It is automatically built from the latest commit on the main branch. It includes some new features and bug fixes that have not yet been released. Be careful when using this version of land-cli as it may be unstable. | |
publish-crates-io: | |
name: publish crates.io | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: build | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Update local toolchain | |
run: | | |
rustup update stable | |
- name: Publish land-sdk-macro | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
run: cargo publish -p land-sdk-macro | |
- name: Publish land-sdk | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
run: cargo publish -p land-sdk |