Skip to content

Bump clap from 4.5.13 to 4.5.14 #66

Bump clap from 4.5.13 to 4.5.14

Bump clap from 4.5.13 to 4.5.14 #66

Workflow file for this run

name: Rust
on:
push:
branches:
- master
env:
CARGO_TERM_COLOR: always
jobs:
trigger:
uses: ./.github/workflows/build.yml
check_tag:
needs: trigger
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract version from Cargo.toml
id: extract_version
run: |
version=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "::notice ::Version from Cargo.toml $version"
- name: Check if version is a Git tag
uses: mukunku/[email protected]
id: check_git_tag
with:
tag: '${{ steps.extract_version.outputs.version }}'
outputs:
version: ${{ steps.extract_version.outputs.version }}
exists: ${{ steps.check_git_tag.outputs.exists }}
tag:
if: ${{ needs.check_tag.outputs.exists == 'false' && github.ref == 'refs/heads/master' }}
needs: check_tag
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create tag
id: tagging
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git tag -a ${{ needs.check_tag.outputs.version }} -m "${{ needs.check_tag.outputs.version }}"
git push origin ${{ needs.check_tag.outputs.version }}
echo "::notice ::Created ${{ needs.check_tag.outputs.version }} tag"
echo "created=true" >> $GITHUB_OUTPUT
- name: Get Repository Name
id: repository
run: echo "name=${GITHUB_REPOSITORY#*/}" >> $GITHUB_OUTPUT
outputs:
created: ${{ steps.tagging.outputs.created }}
version: ${{ needs.check_tag.outputs.version }}
executable: ${{ steps.repository.outputs.name }}
release:
if: ${{ github.ref == 'refs/heads/master' && needs.tag.outputs.created == 'true'}}
needs: tag
runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [
linux
,windows
]
include:
- name: linux
os: ubuntu-latest
target: x86_64-unknown-linux-musl
exec: target/x86_64-unknown-linux-musl/release/${{ needs.tag.outputs.executable }}
file-name: release
- name: windows
os: windows-latest
target: x86_64-pc-windows-msvc
exec: target/x86_64-pc-windows-msvc/release/${{ needs.tag.outputs.executable }}.exe
file-name: release
steps:
- uses: actions/checkout@v4
- name: Install toolchain
uses: actions-rs/[email protected]
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.target }}
- name: Build
id: build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
- name: Upload file
uses: actions/[email protected]
with:
name: ${{ matrix.file-name }}
path: ${{ matrix.exec }}
- name: Print message
run: echo "::notice ::Created binary for ${{ matrix.target }}"
outputs:
version: ${{ needs.tag.outputs.version }}
publish:
needs: release
runs-on: ubuntu-latest
steps:
- name: Download files
uses: actions/[email protected]
- run: find
- name: Release
uses: softprops/action-gh-release@v2
with:
name: ${{ needs.release.outputs.version }}
tag_name: ${{ needs.release.outputs.version }}
files: ./release/*
- name: Print message
run: echo "::notice ::Created ${{ needs.release.outputs.version }} release"
cargo-publish:
needs: publish
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: actions-rs/[email protected]
with:
profile: minimal
toolchain: stable
override: true
- run: cargo publish --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}