Update Rust crate clap_complete to v4.5.41 (#642) #579
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: Publish | |
on: | |
push: | |
tags: | |
- 'v*' | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
build: | |
- aarch64 | |
- aarch64-musl | |
- armv7 | |
- i686 | |
- amd64-musl | |
include: | |
- build: aarch64 | |
os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
use-cross: true | |
features: "--no-default-features --features rustls" | |
- build: aarch64-musl | |
os: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
use-cross: true | |
features: "--no-default-features --features rustls" | |
- build: armv7 | |
os: ubuntu-latest | |
target: armv7-unknown-linux-gnueabihf | |
use-cross: true | |
features: "--no-default-features --features rustls" | |
- build: i686 | |
os: ubuntu-latest | |
target: i686-unknown-linux-gnu | |
use-cross: true | |
features: "--no-default-features --features rustls" | |
- build: amd64-musl | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
use-cross: true | |
features: "--no-default-features --features rustls" | |
steps: | |
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 | |
with: | |
fetch-depth: 0 | |
- name: Install prerequisites | |
shell: bash | |
run: | | |
case ${{ matrix.target }} in | |
arm-unknown-linux-gnueabihf) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;; | |
armv7-unknown-linux-gnueabihf) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;; | |
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;; | |
aarch64-unknown-linux-musl) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;; | |
esac | |
- name: Extract crate information | |
shell: bash | |
run: | | |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV | |
echo "PROJECT_MAINTAINER=$(sed -n 's/^authors = \["\(.*\)"\]/\1/p' Cargo.toml)" >> $GITHUB_ENV | |
echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV | |
PROJECT_VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" | |
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV | |
if [[ $PROJECT_VERSION == *-pre ]]; then | |
echo "VERSION_SUFFIX=nightly" >> $GITHUB_ENV | |
else | |
echo "VERSION_SUFFIX=$PROJECT_VERSION" >> $GITHUB_ENV | |
fi | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
override: true | |
default: true | |
- name: Show version information (Rust, cargo, GCC) | |
shell: bash | |
run: | | |
gcc --version || true | |
rustup -V | |
rustup toolchain list | |
rustup default | |
cargo -V | |
rustc -V | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.use-cross }} | |
command: build | |
args: ${{ matrix.features }} --release --target=${{ matrix.target }} | |
- name: Strip debug information from executable | |
id: strip | |
shell: bash | |
run: | | |
# Figure out what strip tool to use if any | |
STRIP="strip" | |
case ${{ matrix.target }} in | |
arm-unknown-linux-gnueabihf) STRIP="arm-linux-gnueabihf-strip" ;; | |
armv7-unknown-linux-gnueabihf) STRIP="arm-linux-gnueabihf-strip" ;; | |
aarch64-unknown-linux-gnu) STRIP="aarch64-linux-gnu-strip" ;; | |
aarch64-unknown-linux-musl) STRIP="aarch64-linux-gnu-strip" ;; | |
*-pc-windows-msvc) STRIP="" ;; | |
esac; | |
# Setup paths | |
BIN_DIR="_cicd/stripped-release-bin/" | |
mkdir -p "${BIN_DIR}" | |
BIN_NAME="${{ env.PROJECT_NAME }}" | |
BIN_PATH="${BIN_DIR}/${BIN_NAME}_${{ matrix.build }}-${{ env.VERSION_SUFFIX }}" | |
# Copy the release build binary to the result location | |
cp "target/${{ matrix.target }}/release/${BIN_NAME}" "${BIN_PATH}" | |
# Also strip if possible | |
if [ -n "${STRIP}" ]; then | |
"${STRIP}" "${BIN_PATH}" | |
fi | |
# Let subsequent steps know where to find the (stripped) bin | |
echo ::set-output name=BIN_PATH::${BIN_PATH} | |
- name: Publish Release | |
id: publish | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: | | |
${{ steps.strip.outputs.BIN_PATH }} | |
- name: Publish Pre-Release | |
id: publish-pre | |
if: ${{ github.ref }} == 'refs/heads/master' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
uses: "ncipollo/release-action@v1" | |
with: | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: true | |
allowUpdates: true | |
tag: "nightly" | |
commit: "master" | |
name: "dsc nightly" | |
replacesArtifacts: true | |
artifacts: ${{ steps.strip.outputs.BIN_PATH }} | |
build-win: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
default: true | |
- name: Extract crate information | |
shell: bash | |
run: | | |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV | |
PROJECT_VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" | |
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV | |
if [[ $PROJECT_VERSION == *-pre ]]; then | |
echo "VERSION_SUFFIX=nightly" >> $GITHUB_ENV | |
else | |
echo "VERSION_SUFFIX=$PROJECT_VERSION" >> $GITHUB_ENV | |
fi | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: ${{ matrix.features }} --release | |
- name: Rename binary | |
run: | | |
mv target/release/${{ env.PROJECT_NAME }}.exe target/release/${{ env.PROJECT_NAME }}-${{ env.VERSION_SUFFIX }}.exe | |
- name: Publish Release | |
id: publish | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: | | |
target/release/${{ env.PROJECT_NAME }}-${{ env.VERSION_SUFFIX }}.exe | |
- name: Publish Pre-Release | |
id: publish-pre | |
if: ${{ github.ref }} == 'refs/heads/master' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
uses: "ncipollo/release-action@v1" | |
with: | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: true | |
allowUpdates: true | |
tag: "nightly" | |
commit: "master" | |
name: "dsc nightly" | |
replacesArtifacts: true | |
artifacts: target/release/${{ env.PROJECT_NAME }}-${{ env.VERSION_SUFFIX }}.exe | |
build-mac: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: x86_64-apple-darwin | |
override: true | |
default: true | |
- name: Extract crate information | |
shell: bash | |
run: | | |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV | |
PROJECT_VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" | |
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV | |
if [[ $PROJECT_VERSION == *-pre ]]; then | |
echo "VERSION_SUFFIX=nightly" >> $GITHUB_ENV | |
else | |
echo "VERSION_SUFFIX=$PROJECT_VERSION" >> $GITHUB_ENV | |
fi | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: ${{ matrix.features }} --release | |
- name: Rename and strip binary | |
run: | | |
strip target/release/${{ env.PROJECT_NAME }} | |
mv target/release/${{ env.PROJECT_NAME }} target/release/${{ env.PROJECT_NAME }}_darwin-${{ env.VERSION_SUFFIX }} | |
- name: Publish Release | |
id: publish | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
prerelease: ${{ github.ref }} == "refs/heads/master" | |
files: | | |
target/release/${{ env.PROJECT_NAME }}_darwin-${{ env.VERSION_SUFFIX }} | |
- name: Publish Pre-Release | |
id: publish-pre | |
if: ${{ github.ref }} == 'refs/heads/master' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
uses: "ncipollo/release-action@v1" | |
with: | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: true | |
allowUpdates: true | |
tag: "nightly" | |
commit: "master" | |
name: "dsc nightly" | |
replacesArtifacts: true | |
artifacts: target/release/${{ env.PROJECT_NAME }}_darwin-${{ env.VERSION_SUFFIX }} | |
docker: | |
needs: [ build, build-win, build-mac ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Extract crate information | |
shell: bash | |
run: | | |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV | |
echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker Images (${{ env.PROJECT_VERSION }}) | |
run: ./docker/build.sh ${{ env.PROJECT_VERSION }} --push |