From bc07337149d4b730bdc06fc19302b5c94286dacb Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Wed, 2 Aug 2023 13:07:10 -0400 Subject: [PATCH] Update workflow actions to latest Fix various deprecation warnings. The actions-rs and actions/*release* workflows are unmaintained, so replace them with substitutes. Use generic content type for uploaded artifacts. This avoids the need to run the release step once per artifact, and the content types don't seem to be attached to the final download anyway. --- .github/workflows/release.yml | 97 ++++++++++++----------------------- .github/workflows/rust.yml | 23 +++------ .github/workflows/update.yml | 16 ++---- rust-toolchain | 1 - 4 files changed, 44 insertions(+), 93 deletions(-) delete mode 100644 rust-toolchain diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6ad65d5..0324a8c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,18 +13,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout source - uses: actions/checkout@v2 - - name: Install musl - uses: actions-rs/toolchain@v1 + uses: actions/checkout@v3 + - name: Install toolchain + uses: dtolnay/rust-toolchain@stable with: - target: x86_64-unknown-linux-musl + targets: x86_64-unknown-linux-musl - name: Build release (Linux) - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --all-features --target x86_64-unknown-linux-musl + run: cargo build --release --all-features --target x86_64-unknown-linux-musl - run: strip target/x86_64-unknown-linux-musl/release/gptman - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: binary-linux path: target/x86_64-unknown-linux-musl/release/gptman @@ -33,13 +30,14 @@ jobs: runs-on: windows-latest steps: - name: Checkout source - uses: actions/checkout@v2 - - name: Build release (Windows) - uses: actions-rs/cargo@v1 + uses: actions/checkout@v3 + - name: Install toolchain + uses: dtolnay/rust-toolchain@stable with: - command: build - args: --release --all-features --target=x86_64-pc-windows-msvc - - uses: actions/upload-artifact@v2 + targets: x86_64-pc-windows-msvc + - name: Build release (Windows) + run: cargo build --release --all-features --target=x86_64-pc-windows-msvc + - uses: actions/upload-artifact@v3 with: name: binary-windows path: target/x86_64-pc-windows-msvc/release/gptman.exe @@ -48,13 +46,12 @@ jobs: runs-on: macos-latest steps: - name: Checkout source - uses: actions/checkout@v2 + uses: actions/checkout@v3 + - name: Install toolchain + uses: dtolnay/rust-toolchain@stable - name: Build release (OSX) - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --all-features - - uses: actions/upload-artifact@v2 + run: cargo build --release --all-features + - uses: actions/upload-artifact@v3 with: name: binary-osx path: target/release/gptman @@ -63,56 +60,28 @@ jobs: needs: [build-linux, build-windows, build-osx-x86] runs-on: ubuntu-latest steps: - - name: Get the version - id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: binary-linux path: binary-linux - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: binary-windows path: binary-windows - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: binary-osx path: binary-osx - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - body: gptman release ${{ steps.get_version.outputs.VERSION }} - draft: false - prerelease: false - - name: Upload Release Asset Linux - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: binary-linux/gptman - asset_name: gptman-${{ steps.get_version.outputs.VERSION }}-linux-x86_64 - asset_content_type: application/x-pie-executable - - name: Upload Release Asset Windows - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: binary-windows/gptman.exe - asset_name: gptman-${{ steps.get_version.outputs.VERSION }}-win-x86_64.exe - asset_content_type: application/x-dosexec - - name: Upload Release Asset OSX - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Arrange artifacts + run: | + mkdir artifacts + mv binary-linux/gptman "artifacts/gptman-${{ github.ref_name }}-linux-x86_64" + mv binary-windows/gptman.exe "artifacts/gptman-${{ github.ref_name }}-win-x86_64.exe" + mv binary-osx/gptman "artifacts/gptman-${{ github.ref_name }}-osx-x86_64" + - uses: ncipollo/release-action@v1 with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: binary-osx/gptman - asset_name: gptman-${{ steps.get_version.outputs.VERSION }}-osx-x86_64 - asset_content_type: application/x-mach-binary + artifactErrorsFailBuild: true + artifacts: "artifacts/*" + body: gptman release ${{ github.ref_name }} + makeLatest: true + name: Release ${{ github.ref_name }} diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8a6ae52..5ef4a39 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -32,7 +32,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout source - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Select Rust version shell: bash @@ -45,30 +45,19 @@ jobs: fi echo "RUST_VER=$RUST_VER" >> $GITHUB_ENV - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: toolchain: ${{ env.RUST_VER }} - default: true - override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - name: cargo test - uses: actions-rs/cargo@v1 - with: - command: test - args: --workspace ${{ matrix.rust-args }} + run: cargo test --workspace ${{ matrix.rust-args }} - name: rustfmt if: github.event_name == 'pull_request' && matrix.lint - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + run: cargo fmt --all -- --check - name: clippy if: github.event_name == 'pull_request' && matrix.lint - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --all --tests --all-features -- -D warnings + run: cargo clippy --all --tests --all-features -- -D warnings diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 88931fc..e241b12 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -18,23 +18,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout source - uses: actions/checkout@v2 + uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - default: true - override: true + - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - name: cargo update - uses: actions-rs/cargo@v1 - with: - command: update + run: cargo update - name: Open pull request - uses: peter-evans/create-pull-request@v4.0.3 + uses: peter-evans/create-pull-request@v5 with: branch: cargo-update title: "cargo update" diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index 2bf5ad0..0000000 --- a/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -stable