Skip to content

Commit 671b323

Browse files
authored
Update workflow actions to latest (#121)
Fix various deprecation warnings. The `actions-rs` and `actions/*release*` workflows are unmaintained; replace the former with manual Rust commands and the latter with a substitute. 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. Also drop monthly run of Rust workflow. We already have the `cargo update` PR to ensure there's a monthly CI run. Removing the timer from the Rust job allows it to be enabled in forks for pre-PR testing without also running it periodically there.
1 parent 7c09f05 commit 671b323

File tree

4 files changed

+79
-105
lines changed

4 files changed

+79
-105
lines changed

.github/workflows/release.yml

Lines changed: 52 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
tags:
66
- 'v*'
77

8+
env:
9+
CARGO_INCREMENTAL: 0
10+
CARGO_TERM_COLOR: always
11+
812
permissions:
913
contents: write
1014

@@ -13,18 +17,19 @@ jobs:
1317
runs-on: ubuntu-latest
1418
steps:
1519
- name: Checkout source
16-
uses: actions/checkout@v2
17-
- name: Install musl
18-
uses: actions-rs/toolchain@v1
19-
with:
20-
target: x86_64-unknown-linux-musl
20+
uses: actions/checkout@v3
21+
- name: Install toolchain
22+
run: |
23+
rustup toolchain install stable --profile minimal --no-self-update \
24+
--target x86_64-unknown-linux-musl
25+
rustup default stable
26+
echo "Installed:"
27+
cargo --version
28+
rustc --version --verbose
2129
- name: Build release (Linux)
22-
uses: actions-rs/cargo@v1
23-
with:
24-
command: build
25-
args: --release --all-features --target x86_64-unknown-linux-musl
30+
run: cargo build --release --all-features --target x86_64-unknown-linux-musl
2631
- run: strip target/x86_64-unknown-linux-musl/release/gptman
27-
- uses: actions/upload-artifact@v2
32+
- uses: actions/upload-artifact@v3
2833
with:
2934
name: binary-linux
3035
path: target/x86_64-unknown-linux-musl/release/gptman
@@ -33,13 +38,19 @@ jobs:
3338
runs-on: windows-latest
3439
steps:
3540
- name: Checkout source
36-
uses: actions/checkout@v2
41+
uses: actions/checkout@v3
42+
- name: Install toolchain
43+
shell: bash
44+
run: |
45+
rustup toolchain install stable --profile minimal --no-self-update \
46+
--target x86_64-pc-windows-msvc
47+
rustup default stable
48+
echo "Installed:"
49+
cargo --version
50+
rustc --version --verbose
3751
- name: Build release (Windows)
38-
uses: actions-rs/cargo@v1
39-
with:
40-
command: build
41-
args: --release --all-features --target=x86_64-pc-windows-msvc
42-
- uses: actions/upload-artifact@v2
52+
run: cargo build --release --all-features --target=x86_64-pc-windows-msvc
53+
- uses: actions/upload-artifact@v3
4354
with:
4455
name: binary-windows
4556
path: target/x86_64-pc-windows-msvc/release/gptman.exe
@@ -48,13 +59,17 @@ jobs:
4859
runs-on: macos-latest
4960
steps:
5061
- name: Checkout source
51-
uses: actions/checkout@v2
62+
uses: actions/checkout@v3
63+
- name: Install toolchain
64+
run: |
65+
rustup toolchain install stable --profile minimal --no-self-update
66+
rustup default stable
67+
echo "Installed:"
68+
cargo --version
69+
rustc --version --verbose
5270
- name: Build release (OSX)
53-
uses: actions-rs/cargo@v1
54-
with:
55-
command: build
56-
args: --release --all-features
57-
- uses: actions/upload-artifact@v2
71+
run: cargo build --release --all-features
72+
- uses: actions/upload-artifact@v3
5873
with:
5974
name: binary-osx
6075
path: target/release/gptman
@@ -63,56 +78,28 @@ jobs:
6378
needs: [build-linux, build-windows, build-osx-x86]
6479
runs-on: ubuntu-latest
6580
steps:
66-
- name: Get the version
67-
id: get_version
68-
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
69-
- uses: actions/download-artifact@v2
81+
- uses: actions/download-artifact@v3
7082
with:
7183
name: binary-linux
7284
path: binary-linux
73-
- uses: actions/download-artifact@v2
85+
- uses: actions/download-artifact@v3
7486
with:
7587
name: binary-windows
7688
path: binary-windows
77-
- uses: actions/download-artifact@v2
89+
- uses: actions/download-artifact@v3
7890
with:
7991
name: binary-osx
8092
path: binary-osx
81-
- name: Create Release
82-
id: create_release
83-
uses: actions/create-release@v1
84-
env:
85-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86-
with:
87-
tag_name: ${{ github.ref }}
88-
release_name: Release ${{ github.ref }}
89-
body: gptman release ${{ steps.get_version.outputs.VERSION }}
90-
draft: false
91-
prerelease: false
92-
- name: Upload Release Asset Linux
93-
uses: actions/upload-release-asset@v1
94-
env:
95-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96-
with:
97-
upload_url: ${{ steps.create_release.outputs.upload_url }}
98-
asset_path: binary-linux/gptman
99-
asset_name: gptman-${{ steps.get_version.outputs.VERSION }}-linux-x86_64
100-
asset_content_type: application/x-pie-executable
101-
- name: Upload Release Asset Windows
102-
uses: actions/upload-release-asset@v1
103-
env:
104-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105-
with:
106-
upload_url: ${{ steps.create_release.outputs.upload_url }}
107-
asset_path: binary-windows/gptman.exe
108-
asset_name: gptman-${{ steps.get_version.outputs.VERSION }}-win-x86_64.exe
109-
asset_content_type: application/x-dosexec
110-
- name: Upload Release Asset OSX
111-
uses: actions/upload-release-asset@v1
112-
env:
113-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+
- name: Arrange artifacts
94+
run: |
95+
mkdir artifacts
96+
mv binary-linux/gptman "artifacts/gptman-${{ github.ref_name }}-linux-x86_64"
97+
mv binary-windows/gptman.exe "artifacts/gptman-${{ github.ref_name }}-win-x86_64.exe"
98+
mv binary-osx/gptman "artifacts/gptman-${{ github.ref_name }}-osx-x86_64"
99+
- uses: ncipollo/release-action@v1
114100
with:
115-
upload_url: ${{ steps.create_release.outputs.upload_url }}
116-
asset_path: binary-osx/gptman
117-
asset_name: gptman-${{ steps.get_version.outputs.VERSION }}-osx-x86_64
118-
asset_content_type: application/x-mach-binary
101+
artifactErrorsFailBuild: true
102+
artifacts: "artifacts/*"
103+
body: gptman release ${{ github.ref_name }}
104+
makeLatest: true
105+
name: Release ${{ github.ref_name }}

.github/workflows/rust.yml

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ name: Rust
33
on:
44
push:
55
branches: [ main ]
6-
schedule:
7-
- cron: 0 0 1 * *
86
pull_request:
97
branches: [ main ]
108

119
env:
10+
CARGO_INCREMENTAL: 0
1211
CARGO_TERM_COLOR: always
1312

1413
jobs:
@@ -34,43 +33,31 @@ jobs:
3433
runs-on: ${{ matrix.os }}
3534
steps:
3635
- name: Checkout source
37-
uses: actions/checkout@v2
36+
uses: actions/checkout@v3
3837

39-
- name: Select Rust version
38+
- name: Install toolchain
4039
shell: bash
4140
run: |
42-
RUST_VER="${{ matrix.rust }}"
43-
if [ "$RUST_VER" = msrv ]; then
44-
RUST_VER=$(cargo metadata --format-version 1 --no-deps | \
41+
ver="${{ matrix.rust }}"
42+
if [ "$ver" = msrv ]; then
43+
ver=$(cargo metadata --format-version 1 --no-deps | \
4544
jq -r '.packages[0].rust_version')
46-
echo "MSRV: $RUST_VER"
4745
fi
48-
echo "RUST_VER=$RUST_VER" >> $GITHUB_ENV
46+
rustup toolchain install "$ver" --profile minimal --no-self-update
47+
rustup default "$ver"
48+
echo "Installed:"
49+
cargo --version
50+
rustc --version --verbose
4951
50-
- uses: actions-rs/toolchain@v1
51-
with:
52-
toolchain: ${{ env.RUST_VER }}
53-
default: true
54-
override: true
55-
56-
- uses: Swatinem/rust-cache@v1
52+
- uses: Swatinem/rust-cache@v2
5753

5854
- name: cargo test
59-
uses: actions-rs/cargo@v1
60-
with:
61-
command: test
62-
args: --workspace ${{ matrix.rust-args }}
55+
run: cargo test --workspace ${{ matrix.rust-args }}
6356

6457
- name: rustfmt
6558
if: github.event_name == 'pull_request' && matrix.lint
66-
uses: actions-rs/cargo@v1
67-
with:
68-
command: fmt
69-
args: --all -- --check
59+
run: cargo fmt --all -- --check
7060

7161
- name: clippy
7262
if: github.event_name == 'pull_request' && matrix.lint
73-
uses: actions-rs/clippy-check@v1
74-
with:
75-
token: ${{ secrets.GITHUB_TOKEN }}
76-
args: --all --tests --all-features -- -D warnings
63+
run: cargo clippy --all --tests --all-features -- -D warnings

.github/workflows/update.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
workflow_dispatch:
77

88
env:
9+
CARGO_INCREMENTAL: 0
910
CARGO_TERM_COLOR: always
1011

1112
permissions:
@@ -18,23 +19,23 @@ jobs:
1819
runs-on: ubuntu-latest
1920
steps:
2021
- name: Checkout source
21-
uses: actions/checkout@v2
22+
uses: actions/checkout@v3
2223

23-
- uses: actions-rs/toolchain@v1
24-
with:
25-
toolchain: stable
26-
default: true
27-
override: true
24+
- name: Install toolchain
25+
run: |
26+
rustup toolchain install stable --profile minimal --no-self-update
27+
rustup default stable
28+
echo "Installed:"
29+
cargo --version
30+
rustc --version --verbose
2831
29-
- uses: Swatinem/rust-cache@v1
32+
- uses: Swatinem/rust-cache@v2
3033

3134
- name: cargo update
32-
uses: actions-rs/cargo@v1
33-
with:
34-
command: update
35+
run: cargo update
3536

3637
- name: Open pull request
37-
uses: peter-evans/create-pull-request@v4.0.3
38+
uses: peter-evans/create-pull-request@v5
3839
with:
3940
branch: cargo-update
4041
title: "cargo update"

rust-toolchain

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)