chore: upload release packages #190
Workflow file for this run
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: | |
tags: | |
- v* | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: | |
- x86_64-unknown-linux-gnu | |
- x86_64-unknown-linux-musl | |
- aarch64-unknown-linux-gnu | |
- aarch64-unknown-linux-musl | |
steps: | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: false | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: true | |
swap-storage: true | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.target }} | |
cache-on-failure: true | |
- name: Get the release version from the tag | |
shell: bash | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Install cross-compilation tools | |
uses: taiki-e/setup-cross-toolchain-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
- name: Install cargo-deb | |
uses: taiki-e/cache-cargo-install-action@v2 | |
with: | |
tool: cargo-deb | |
- name: Install cargo-generate-rpm | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-generate-rpm | |
- name: Install dependencies | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y protobuf-compiler libclang-dev | |
- name: Build binaries | |
shell: bash | |
run: | | |
cargo build --release --bins --target ${{ matrix.target }} | |
- name: Build archive client(DEB) | |
shell: bash | |
run: | | |
binary_name="client" | |
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}" | |
cargo deb -p dragonfly-client --target ${{ matrix.target }} --variant ${{ matrix.target }} --output $dirname.deb | |
echo "CLIENT_DEB_ASSET=$dirname.deb" >> $GITHUB_ENV | |
# - name: Build archive client(RPM) | |
# shell: bash | |
# run: | | |
# binary_name="client" | |
# dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}" | |
# cargo generate-rpm -p dragonfly-client --target ${{ matrix.target }} --variant ${{ matrix.target }} --output $dirname.rpm | |
# echo "CLIENT_RPM_ASSET=$dirname.rpm" >> $GITHUB_ENV | |
- name: Build archive client(TAR) | |
shell: bash | |
run: | | |
binary_name="client" | |
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}" | |
mkdir -p "$dirname" | |
mv "target/${{ matrix.target }}/release/dfget" "$dirname" | |
mv "target/${{ matrix.target }}/release/dfdaemon" "$dirname" | |
mv "target/${{ matrix.target }}/release/dfstore" "$dirname" | |
mv "target/${{ matrix.target }}/release/dfcache" "$dirname" | |
mv "target/${{ matrix.target }}/release/dfinit" "$dirname" | |
mv CONTRIBUTING.md LICENSE README.md "$dirname" | |
tar -czf "$dirname.tar.gz" "$dirname" | |
echo "CLIENT_TAR_ASSET=$dirname.tar.gz" >> $GITHUB_ENV | |
- name: Upload Release Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-${{ matrix.target }} | |
path: | | |
${{ env.CLIENT_RPM_ASSET }} | |
${{ env.CLIENT_DEB_ASSET }} | |
${{ env.CLIENT_TAR_ASSET }} | |
release-github: | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Download Release Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: releases | |
pattern: release-* | |
merge-multiple: true | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
generate_release_notes: true | |
draft: true | |
files: | | |
releases/*.rpm | |
releases/*.deb | |
releases/*.tar.gz | |
publish-crates: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: false | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: true | |
swap-storage: true | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install protobuf-compiler libclang-dev | |
- uses: katyo/publish-crates@v2 | |
with: | |
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
ignore-unpublished-changes: true |