deps: lock file maintenance #1910
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: build | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
workflow_call: | |
inputs: | |
tag-name: | |
required: true | |
type: string | |
jobs: | |
build: | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
profile: ${{ github.ref_name == github.event.repository.default_branch && fromJson('["dev", "release"]') || fromJson('["dev"]') }} | |
platform: | |
- target: aarch64-unknown-linux-musl | |
os: ubuntu-22.04 | |
command: cross | |
- target: x86_64-unknown-linux-musl | |
os: ubuntu-22.04 | |
command: cargo | |
- target: aarch64-apple-darwin | |
os: macos-14 | |
command: cargo | |
- target: x86_64-apple-darwin | |
os: macos-14 | |
command: cargo | |
- target: x86_64-pc-windows-msvc | |
os: windows-2022 | |
command: cargo | |
runs-on: ${{ matrix.platform.os }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
defaults: | |
run: | |
shell: bash -xe {0} | |
steps: | |
- name: Install musl tools | |
if: matrix.platform.target == 'x86_64-unknown-linux-musl' | |
run: | | |
sudo apt-get install -y musl-tools --no-install-recommends | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
filter: tree:0 | |
fetch-depth: 0 | |
- run: | | |
rustup target add ${{ matrix.platform.target }} | |
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 | |
with: | |
key: ${{ matrix.profile }}-${{ matrix.platform.target }} | |
- name: Install cross | |
if: ${{ matrix.platform.command == 'cross' }} | |
uses: taiki-e/install-action@df5dec2a2f73ff6dbace3072df1242669b7bb7d1 # v2.47.9 | |
with: | |
tool: cross | |
- run: ${{ matrix.platform.command }} build --locked --bins ${{ matrix.profile == 'release' && '--release' || '' }} --target ${{ matrix.platform.target }} | |
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 | |
with: | |
name: ${{ matrix.profile }}-${{ matrix.platform.target }} | |
path: | | |
target/${{ matrix.platform.target }}/debug/pcsc-rs | |
target/${{ matrix.platform.target }}/debug/pcsc-rs.exe | |
target/${{ matrix.platform.target }}/release/pcsc-rs | |
target/${{ matrix.platform.target }}/release/pcsc-rs.exe | |
if-no-files-found: error | |
- name: Upload to release | |
if: ${{ inputs.tag-name && matrix.profile == 'release' }} | |
working-directory: target/${{ matrix.platform.target }}/release/ | |
run: | | |
if [ -e pcsc-rs.exe ]; then | |
filename="pcsc-rs-${{ inputs.tag-name }}-${{ matrix.platform.target }}.exe" | |
mv pcsc-rs.exe "$filename" | |
gh release upload ${{ inputs.tag-name }} "$filename"#${{ matrix.platform.target }} --clobber | |
else | |
filename="pcsc-rs-${{ inputs.tag-name }}-${{ matrix.platform.target }}" | |
mv pcsc-rs "$filename" | |
gh release upload ${{ inputs.tag-name }} "$filename"#${{ matrix.platform.target }} --clobber | |
fi |