Skip to content

Commit

Permalink
Update workflow actions to latest
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bgilbert committed Aug 2, 2023
1 parent bb1487f commit bc07337
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 93 deletions.
97 changes: 33 additions & 64 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 }}
23 changes: 6 additions & 17 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
16 changes: 5 additions & 11 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion rust-toolchain

This file was deleted.

0 comments on commit bc07337

Please sign in to comment.