Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flake ref output #169

Merged
merged 10 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- nix-system: aarch64-darwin
runner: macos-latest-xlarge
- nix-system: x86_64-darwin
runner: macos-12
runner: macos-13-large
steps:
- uses: actions/checkout@v3

Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ Although the `flakehub-push` Action requires little configuration, you may benef

## Integration

This action sets the `flakeref` output to the exact name and version that was published.
The flake reference can be used in subsequent steps or workflows as part of a deployment process.
This action sets outputs for integrating into CD pipelines:
grahamc marked this conversation as resolved.
Show resolved Hide resolved
grahamc marked this conversation as resolved.
Show resolved Hide resolved

- `flake_name` Name of the flake. Example: `DeterminateSystems/flakehub-push`
- `flake_version` Name of the flake. Example: `0.1.99+rev-2075013a3f3544d45a96f4b35df4ed03cd53779c`
cole-h marked this conversation as resolved.
Show resolved Hide resolved
- `flakeref_descriptive` A loose reference to this release. Depending on this reference will require at least this version, and will also resolve to newer releases. This output is not sufficient for deployment pipelines, use `flake_exact` instead. Example: `DeterminateSystems/flakehub-push/0.1.99+rev-2075013a3f3544d45a96f4b35df4ed03cd53779c`
grahamc marked this conversation as resolved.
Show resolved Hide resolved
- `flake_exact` A precise reference that always resolves to this to this exact release. Example: `DeterminateSystems/flakehub-push/=0.1.99+rev-2075013a3f3544d45a96f4b35df4ed03cd53779c`
grahamc marked this conversation as resolved.
Show resolved Hide resolved

## More Information

Expand Down
28 changes: 21 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,27 @@ async fn execute() -> Result<std::process::ExitCode> {
ctx.release_version
);

if let Err(e) = github_actions::set_output(
"flakeref",
&format!("{}/{}", ctx.upload_name, ctx.release_version),
)
.await
{
tracing::warn!("Failed to set the `flakeref` output: {}", e);
let outputs = [
("flake_name", &ctx.upload_name),
("flake_version", &ctx.release_version),
(
"flakeref_descriptive",
&format!("{}/{}", ctx.upload_name, ctx.release_version),
),
(
"flakeref_exact",
&format!("{}/={}", ctx.upload_name, ctx.release_version),
),
];
for (output_name, value) in outputs.into_iter() {
if let Err(e) = github_actions::set_output(output_name, value).await {
tracing::warn!(
"Failed to set the `{}` output to {}: {}",
output_name,
value,
e
);
}
}

Ok(ExitCode::SUCCESS)
Expand Down
Loading