diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 731885b..675984d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -114,22 +114,20 @@ jobs: matrix: include: - build: linux - os: ubuntu-latest + os: ubuntu-20.04 target: x86_64-unknown-linux-gnu - packages: clang - cc: clang - - build: linux - os: ubuntu-latest + - build: linux-aarch64 + os: ubuntu-20.04 target: aarch64-unknown-linux-gnu - packages: "libc6-dev-arm64-cross gcc-aarch64-linux-gnu" - cc: aarch64-linux-gnu-gcc - build: windows-gnu - os: windows-latest + os: windows-2019 target: x86_64-pc-windows-gnu - packages: gcc-mingw-w64-x86-64-win32 - cc: mingw-w64-x86-64-win32-gcc + + - build: mac-m1 + os: macos-14 + target: aarch64-apple-darwin steps: - name: Clone repository @@ -160,7 +158,9 @@ jobs: if [ "${{ matrix.target }}" = "x86_64-unknown-linux-gnu" ]; then exit 0 fi - sudo apt-get install --no-install-recommends -y ${{ matrix.packages }} + if [ "${{ matrix.target }}" = "aarch64-unknown-linux-gnu" ]; then + sudo apt-get install --no-install-recommends -y libc6-dev-arm64-cross gcc-aarch64-linux-gnu + fi - name: Install target shell: bash @@ -171,11 +171,13 @@ jobs: rustup target add ${{ matrix.target }} - name: Build - env: - RUSTFLAGS: '-C target-feature=+crt-static -C linker=${{ matrix.cc }}' shell: bash run: | - CC=${{ matrix.cc }} cargo build --verbose --release --target ${{ matrix.target }} + if [ "${{ matrix.target }}" = "aarch64-unknown-linux-gnu" ]; then + CC=aarch64-linux-gnu-gcc RUSTFLAGS="-C target-feature=+crt-static -C linker=aarch64-linux-gnu-gcc" cargo build --verbose --release --target ${{ matrix.target }} + else + RUSTFLAGS="-C target-feature=+crt-static" cargo build --verbose --release --target ${{ matrix.target }} + fi - name: Build archive shell: bash @@ -187,8 +189,45 @@ jobs: mv "target/${{ matrix.target }}/release/$binary_name" "$dirname" tar -czf "$dirname.tar.gz" "$dirname" echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV + + - name: Save Release URL File for publish + uses: actions/upload-artifact@v4 + with: + path: ${{ env.ASSET }} + retention-days: 1 + + + build-and-upload: + name: Build and upload + runs-on: ubuntu-latest + needs: build-and-upload + + steps: + - name: Clone repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Get the release version from the tag + shell: bash + run: | + set +e + echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + if echo "${GITHUB_REF#refs/tags/}" | grep -q "rc"; then + echo "PRERELEASE=true" >> $GITHUB_ENV + else + echo "PRERELEASE=false" >> $GITHUB_ENV + fi + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + path: ./artifacts + merge-multiple: true + - name: Generate Changelog + shell: bash run: | if ${{ env.PRERELEASE }}; then echo "This is a prerelease for testing purposes. For real usage please use the latest stable release." > ${{ env.VERSION }}-CHANGELOG.txt @@ -202,4 +241,4 @@ jobs: body_path: ${{ env.VERSION }}-CHANGELOG.txt prerelease: ${{ env.PRERELEASE }} files: | - ${{ env.ASSET }} + ./artifacts/*