Bump actions/upload-artifact from 4.6.0 to 4.6.1 #323
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 Debian packages | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
target: | |
- armv7-unknown-linux-musleabihf | |
- x86_64-unknown-linux-gnu | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4.2.2 | |
- name: Set up Cargo cache | |
uses: actions/cache@v4.2.0 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: Install cross-compilation tools | |
uses: taiki-e/setup-cross-toolchain-action@v1.28.1 | |
if: ${{ matrix.target }} != 'x86_64-unknown-linux-gnu' | |
with: | |
target: ${{ matrix.target }} | |
- name: Perform build | |
run: | | |
cargo build --target ${{ matrix.target }} --release --features "" | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4.6.1 | |
with: | |
name: ${{ matrix.target }}-executables | |
path: target/**/release/dsmr-rs | |
retention-days: 1 | |
build-packages: | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Cargo cache | |
uses: actions/cache@v4.2.0 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: Download all build artifacts | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
path: /tmp/artifacts | |
- name: Move executables to target directory | |
run: | | |
archs=("armv7-unknown-linux-musleabihf" "x86_64-unknown-linux-gnu") | |
for arch in ${archs[@]}; do | |
echo Copying binary for $arch | |
mkdir -p target/$arch/release | |
cp /tmp/artifacts/$arch-executables/$arch/release/dsmr-rs target/$arch/release/dsmr-rs | |
echo Verifying binary for $arch | |
file target/$arch/release/dsmr-rs | |
done | |
- name: Prepare packaging | |
run: | | |
sudo apt update -y | |
sudo apt install -y dpkg dpkg-dev liblzma-dev libssl-dev | |
cargo install cargo-deb | |
rustup target add armv7-unknown-linux-musleabihf | |
- name: Create Debian package | |
run: | | |
cargo deb --target armv7-unknown-linux-musleabihf --no-build --no-strip -v | |
cargo deb --target x86_64-unknown-linux-gnu --no-build --no-strip -v | |
- name: Inspect generated packages | |
run: | | |
find target/ -name "*.deb" -exec file {} \; | |
- name: Upload Debian packages | |
uses: actions/upload-artifact@v4.6.1 | |
if: github.ref == 'refs/heads/main' | |
with: | |
name: packages | |
path: | | |
target/armv7-unknown-linux-musleabihf/debian/ | |
target/x86_64-unknown-linux-gnu/debian/ |