Skip to content

Commit

Permalink
Scope env vars to the job definition that needs them
Browse files Browse the repository at this point in the history
The variables that controlled the behavior of Rust programs and the
output of `cargo` are only used in the `build-release` job, not in
the `create-release` jobs, and one of them was already set in the
more suitable narrower scope. This moves them to that scope,
without duplication. They still apply to all steps in the build
jobs.

This also:

- Adjusts comment wording to clarify how `CARGO` is set and used.

- Quotes `1` as an environment variable value, since such values
  are always strings (it was being converted), but having it as a
  numeric YAML literal made it seem like that was not the case.

- Adds spacing for clarity and for stylistic consistency across the
  two job definitions.
  • Loading branch information
EliahKagan committed Jul 31, 2024
1 parent c2a9dcc commit ca8d62e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ on:
tags:
- 'v*'

env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CLICOLOR: 1

defaults:
run:
shell: bash
Expand All @@ -27,10 +22,13 @@ jobs:
# from building the release so that we only create the release once.
create-release:
name: create-release

runs-on: ubuntu-latest

# env:
# # Set to force version number, e.g., when no tag exists.
# VERSION: TEST-0.0.0

steps:
- name: Create artifacts directory
run: mkdir artifacts
Expand Down Expand Up @@ -133,10 +131,12 @@ jobs:
runs-on: ${{ matrix.os }}

env:
CARGO: cargo # On Linux, this will be changed to `cross` later.
CARGO: cargo # On Linux, this will be changed to `cross` in a later step.
TARGET_FLAGS: --target=${{ matrix.target }}
TARGET_DIR: ./target/${{ matrix.target }}
RUST_BACKTRACE: 1 # Emit backtraces on panics.
RUST_BACKTRACE: '1' # Emit backtraces on panics.
CARGO_TERM_COLOR: always
CLICOLOR: '1'

steps:
- name: Checkout repository
Expand Down

0 comments on commit ca8d62e

Please sign in to comment.