From be7bb2897236cbab8287b193252a4c844c88930e Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 16 Aug 2021 21:16:44 +0800 Subject: [PATCH] Hopefully get binary releases back Using a copy of this file of dua-cli --- .github/workflows/release.yml | 64 ++++++++++++++++------------------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7b74fd5..5db2f8f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,17 +14,17 @@ name: release on: push: # Enable when testing release infrastructure on a branch. -# branches: -# - release + # branches: + # - ag/release tags: - - 'v[0-9]+.[0-9]+.[0-9]+' + - "v[0-9]+.[0-9]+.[0-9]+" jobs: create-release: name: create-release runs-on: ubuntu-latest -# env: -# # Set to force version number, e.g., when no tag exists. -# ARTIFACT_VERSION: TEST-0.0.1 + # env: + # Set to force version number, e.g., when no tag exists. + # ARTIFACT_VERSION: TEST-0.0.0 steps: - name: Create artifacts directory run: mkdir artifacts @@ -32,10 +32,7 @@ jobs: - name: Get the release version from the tag if: env.ARTIFACT_VERSION == '' run: | - # Apparently, this is the right way to get a tag name. Really? - # - # See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027 - echo "::set-env name=ARTIFACT_VERSION::${GITHUB_REF#refs/tags/}" + echo "ARTIFACT_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV echo "version is: ${{ env.ARTIFACT_VERSION }}" - name: Create GitHub release @@ -61,7 +58,7 @@ jobs: build-release: name: build-release - needs: ['create-release'] + needs: ["create-release"] runs-on: ${{ matrix.os }} env: # For some builds, we use cross to test on 32-bit and big-endian @@ -73,14 +70,15 @@ jobs: TARGET_DIR: ./target # Emit backtraces on panics. RUST_BACKTRACE: 1 - BIN_NAME: cargo-diet + # The name of the executable to expect + EXE_NAME: cargo-diet strategy: matrix: build: [linux, linux-arm, macos, win-msvc, win-gnu, win32-msvc] include: - build: linux os: ubuntu-18.04 - rust: nightly + rust: stable target: x86_64-unknown-linux-musl - build: linux-arm os: ubuntu-18.04 @@ -88,9 +86,8 @@ jobs: target: arm-unknown-linux-gnueabihf - build: macos os: macos-latest - rust: nightly + rust: stable target: x86_64-apple-darwin -# no windows support, at least not with GUI (see https://github.com/Byron/dua-cli/issues/2) - build: win-msvc os: windows-2019 rust: nightly @@ -106,7 +103,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v1 + uses: actions/checkout@v2 with: fetch-depth: 1 @@ -129,14 +126,12 @@ jobs: target: ${{ matrix.target }} - name: Use Cross + # if: matrix.os != 'windows-2019' run: | - # FIXME: to work around bugs in latest cross release, install master. - # ME: Still needed? Issue seems closed - # See: https://github.com/rust-embedded/cross/issues/357 - cargo install --git https://github.com/rust-embedded/cross - echo "::set-env name=CARGO::cross" - echo "::set-env name=TARGET_FLAGS::--target ${{ matrix.target }}" - echo "::set-env name=TARGET_DIR::./target/${{ matrix.target }}" + cargo install cross + echo "CARGO=cross" >> $GITHUB_ENV + echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV + echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV - name: Show command used for Cargo run: | @@ -154,10 +149,10 @@ jobs: shell: bash run: | release_upload_url="$(cat artifacts/release-upload-url)" - echo "::set-env name=RELEASE_UPLOAD_URL::$release_upload_url" + echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV echo "release upload url: $RELEASE_UPLOAD_URL" release_version="$(cat artifacts/release-version)" - echo "::set-env name=RELEASE_VERSION::$release_version" + echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV echo "release version: $RELEASE_VERSION" - name: Build release binary @@ -165,8 +160,7 @@ jobs: - name: Strip release binary (linux and macos) if: matrix.build == 'linux' || matrix.build == 'macos' - run: strip "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}" - + run: strip "target/${{ matrix.target }}/release/${{ env.EXE_NAME }}" - name: Strip release binary (arm) if: matrix.build == 'linux-arm' run: | @@ -174,24 +168,24 @@ jobs: "$PWD/target:/target:Z" \ rustembedded/cross:arm-unknown-linux-gnueabihf \ arm-linux-gnueabihf-strip \ - /target/arm-unknown-linux-gnueabihf/release/${{ env.BIN_NAME }} - + /target/arm-unknown-linux-gnueabihf/release/${{ env.EXE_NAME }} - name: Build archive shell: bash run: | - staging="${{ env.BIN_NAME }}-${{ env.RELEASE_VERSION }}-${{ matrix.target }}" - mkdir -p "$staging" + staging="${{ env.EXE_NAME }}-${{ env.RELEASE_VERSION }}-${{ matrix.target }}" + mkdir -p "$staging"/complete cp {README.md,LICENSE.md,CHANGELOG.md} "$staging/" if [ "${{ matrix.os }}" = "windows-2019" ]; then - cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}.exe" "$staging/" + # cp "target/${{ matrix.target }}/release/${{ env.EXE_NAME }}.exe" "$staging/" + cp "target/release/${{ env.EXE_NAME }}.exe" "$staging/" 7z a "$staging.zip" "$staging" - echo "::set-env name=ASSET::$staging.zip" + echo "ASSET=$staging.zip" >> $GITHUB_ENV else - cp "target/${{ matrix.target }}/release/${{ env.BIN_NAME }}" "$staging/" + cp "target/${{ matrix.target }}/release/${{ env.EXE_NAME }}" "$staging/" tar czf "$staging.tar.gz" "$staging" - echo "::set-env name=ASSET::$staging.tar.gz" + echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV fi - name: Upload release archive