diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3c1678..6acd8d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,7 @@ name: Build and Test env: RUSTFLAGS: -Dwarnings + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} on: push: branches: @@ -49,5 +50,10 @@ jobs: run: cargo +nightly fmt --check - name: Cargo Clippy run: cargo +nightly clippy --all-features --workspace -- -D warnings + release: + needs: build + name: Release + runs-on: ubuntu-latest + steps: - name: Release Plz uses: MarcoIeni/release-plz-action@v0.5 diff --git a/workspace/gh-workflow-gen/build.rs b/workspace/gh-workflow-gen/build.rs index 2cc18a6..39bf0a5 100644 --- a/workspace/gh-workflow-gen/build.rs +++ b/workspace/gh-workflow-gen/build.rs @@ -3,6 +3,8 @@ use gh_workflow_release_plz::ReleasePlz; use toolchain::Toolchain; fn main() { + let flags = RustFlags::deny("warnings"); + let job = Job::new("Build and Test") .add_step(Step::checkout()) .add_step( @@ -28,8 +30,7 @@ fn main() { .nightly() .args("--all-features --workspace -- -D warnings") .name("Cargo Clippy"), - ) - .add_step(ReleasePlz::default()); + ); let event = Event::default() .push(Push::default().add_branch("main")) @@ -41,13 +42,17 @@ fn main() { .add_branch("main"), ); - let flags = RustFlags::deny("warnings"); + let release = Job::new("Release") + .add_step(ReleasePlz::default()) + .needs("build"); Workflow::new("Build and Test") - .env(flags) + .add_env(flags) + .add_env(("GITHUB_TOKEN", "${{ secrets.GH_TOKEN }}")) .permissions(Permissions::read()) .on(event) .add_job("build", job) + .add_job("release", release) .generate() .unwrap(); }