Skip to content

Commit

Permalink
chore: multipart upload release packages
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi committed Sep 5, 2024
1 parent e44fbd5 commit 5806e55
Showing 1 changed file with 100 additions and 101 deletions.
201 changes: 100 additions & 101 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,78 +6,78 @@ on:
- v*

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 480
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
# build:
# runs-on: ubuntu-latest
# timeout-minutes: 480
# 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: 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 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(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
Expand All @@ -87,29 +87,29 @@ jobs:
# 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 }}
# - 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
Expand All @@ -118,21 +118,20 @@ jobs:
permissions:
contents: write
steps:
- name: Download Release Artifacts
uses: actions/download-artifact@v4
with:
path: releases
pattern: release-*
merge-multiple: true
# - name: Download Release Artifacts
# uses: actions/download-artifact@v4
# with:
# path: releases
# pattern: release-*
# merge-multiple: true

- name: Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
# artifacts: "releases/*"
generateReleaseNotes: true
allowUpdates: true
draft: true
generateReleaseNotes: true
artifacts: "releases/*.rpm,releases/*.deb,releases/*.tar.gz"

publish-crates:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 5806e55

Please sign in to comment.