Skip to content

Commit e994df0

Browse files
authored
Merge pull request #153 from DeterminateSystems/fixup-post-build-hook-argument-parsing
fixup: post-build-hook argument parsing
2 parents c2f46a0 + 4bb94dd commit e994df0

File tree

6 files changed

+57
-150
lines changed

6 files changed

+57
-150
lines changed

.github/workflows/release-branches.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,31 +37,33 @@ jobs:
3737
name: magic-nix-cache-ARM64-macOS
3838
path: cache-binary-ARM64-macOS
3939
- name: Persist the cache binary
40-
run: cp ./cache-binary-ARM64-macOS/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-ARM64-macOS
40+
run: cp ./cache-binary-ARM64-macOS/magic-nix-cache.closure.xz ./artifacts/ARM64-macOS
4141

4242
- uses: actions/download-artifact@v4.1.8
4343
with:
4444
name: magic-nix-cache-X64-macOS
4545
path: cache-binary-X64-macOS
4646
- name: Persist the cache binary
47-
run: cp ./cache-binary-X64-macOS/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-X64-macOS
47+
run: cp ./cache-binary-X64-macOS/magic-nix-cache.closure.xz ./artifacts/X64-macOS
4848

4949
- uses: actions/download-artifact@v4.1.8
5050
with:
5151
name: magic-nix-cache-X64-Linux
5252
path: cache-binary-X64-Linux
5353
- name: Persist the cache binary
54-
run: cp ./cache-binary-X64-Linux/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-X64-Linux
54+
run: cp ./cache-binary-X64-Linux/magic-nix-cache.closure.xz ./artifacts/X64-Linux
5555

5656
- uses: actions/download-artifact@v4.1.8
5757
with:
5858
name: magic-nix-cache-ARM64-Linux
5959
path: cache-binary-ARM64-Linux
6060
- name: Persist the cache binary
61-
run: cp ./cache-binary-ARM64-Linux/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-ARM64-Linux
61+
run: cp ./cache-binary-ARM64-Linux/magic-nix-cache.closure.xz ./artifacts/ARM64-Linux
6262

63-
- name: Publish Release (Branch)
64-
env:
65-
AWS_BUCKET: ${{ secrets.AWS_S3_UPLOAD_BUCKET }}
66-
run: |
67-
.github/workflows/upload_s3.sh branch "${{ github.ref_name }}" "$GITHUB_SHA"
63+
- uses: DeterminateSystems/push-artifact-ids@main
64+
with:
65+
s3_upload_role: ${{ secrets.AWS_S3_UPLOAD_ROLE }}
66+
bucket: ${{ secrets.AWS_S3_UPLOAD_BUCKET }}
67+
directory: ./artifacts
68+
ids_project_name: magic-nix-cache
69+
ids_binary_prefix: magic-nix-cache

.github/workflows/release-prs.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,36 +41,33 @@ jobs:
4141
name: magic-nix-cache-ARM64-macOS
4242
path: cache-binary-ARM64-macOS
4343
- name: Persist the cache binary
44-
run: cp ./cache-binary-ARM64-macOS/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-ARM64-macOS
44+
run: cp ./cache-binary-ARM64-macOS/magic-nix-cache.closure.xz ./artifacts/ARM64-macOS
4545

4646
- uses: actions/download-artifact@v4.1.8
4747
with:
4848
name: magic-nix-cache-X64-macOS
4949
path: cache-binary-X64-macOS
5050
- name: Persist the cache binary
51-
run: cp ./cache-binary-X64-macOS/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-X64-macOS
51+
run: cp ./cache-binary-X64-macOS/magic-nix-cache.closure.xz ./artifacts/X64-macOS
5252

5353
- uses: actions/download-artifact@v4.1.8
5454
with:
5555
name: magic-nix-cache-X64-Linux
5656
path: cache-binary-X64-Linux
5757
- name: Persist the cache binary
58-
run: cp ./cache-binary-X64-Linux/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-X64-Linux
58+
run: cp ./cache-binary-X64-Linux/magic-nix-cache.closure.xz ./artifacts/X64-Linux
5959

6060
- uses: actions/download-artifact@v4.1.8
6161
with:
6262
name: magic-nix-cache-ARM64-Linux
6363
path: cache-binary-ARM64-Linux
6464
- name: Persist the cache binary
65-
run: cp ./cache-binary-ARM64-Linux/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-ARM64-Linux
65+
run: cp ./cache-binary-ARM64-Linux/magic-nix-cache.closure.xz ./artifacts/ARM64-Linux
6666

67-
- name: Configure AWS Credentials
68-
uses: aws-actions/configure-aws-credentials@v2
67+
- uses: DeterminateSystems/push-artifact-ids@main
6968
with:
70-
role-to-assume: ${{ secrets.AWS_S3_UPLOAD_ROLE }}
71-
aws-region: us-east-2
72-
- name: Publish Release (PR)
73-
env:
74-
AWS_BUCKET: ${{ secrets.AWS_S3_UPLOAD_BUCKET }}
75-
run: |
76-
.github/workflows/upload_s3.sh pr "${{ github.event.pull_request.number }}" "${{ github.event.pull_request.head.sha }}"
69+
s3_upload_role: ${{ secrets.AWS_S3_UPLOAD_ROLE }}
70+
bucket: ${{ secrets.AWS_S3_UPLOAD_BUCKET }}
71+
directory: ./artifacts
72+
ids_project_name: magic-nix-cache
73+
ids_binary_prefix: magic-nix-cache

.github/workflows/release-tags.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,39 +29,44 @@ jobs:
2929
name: magic-nix-cache-ARM64-macOS
3030
path: cache-binary-ARM64-macOS
3131
- name: Persist the cache binary
32-
run: cp ./cache-binary-ARM64-macOS/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-ARM64-macOS
32+
run: cp ./cache-binary-ARM64-macOS/magic-nix-cache.closure.xz ./artifacts/ARM64-macOS
3333

3434
- uses: actions/download-artifact@v4.1.8
3535
with:
3636
name: magic-nix-cache-X64-macOS
3737
path: cache-binary-X64-macOS
3838
- name: Persist the cache binary
39-
run: cp ./cache-binary-X64-macOS/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-X64-macOS
39+
run: cp ./cache-binary-X64-macOS/magic-nix-cache.closure.xz ./artifacts/X64-macOS
4040

4141
- uses: actions/download-artifact@v4.1.8
4242
with:
4343
name: magic-nix-cache-X64-Linux
4444
path: cache-binary-X64-Linux
4545
- name: Persist the cache binary
46-
run: cp ./cache-binary-X64-Linux/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-X64-Linux
46+
run: cp ./cache-binary-X64-Linux/magic-nix-cache.closure.xz ./artifacts/X64-Linux
4747

4848
- uses: actions/download-artifact@v4.1.8
4949
with:
5050
name: magic-nix-cache-ARM64-Linux
5151
path: cache-binary-ARM64-Linux
5252
- name: Persist the cache binary
53-
run: cp ./cache-binary-ARM64-Linux/magic-nix-cache.closure.xz ./artifacts/magic-nix-cache-ARM64-Linux
53+
run: cp ./cache-binary-ARM64-Linux/magic-nix-cache.closure.xz ./artifacts/ARM64-Linux
5454

55-
- name: Configure AWS Credentials
56-
uses: aws-actions/configure-aws-credentials@v2
55+
- uses: DeterminateSystems/push-artifact-ids@main
5756
with:
58-
role-to-assume: ${{ secrets.AWS_S3_UPLOAD_ROLE }}
59-
aws-region: us-east-2
60-
- name: Publish Release to S3 (Tag)
61-
env:
62-
AWS_BUCKET: ${{ secrets.AWS_S3_UPLOAD_BUCKET }}
57+
s3_upload_role: ${{ secrets.AWS_S3_UPLOAD_ROLE }}
58+
bucket: ${{ secrets.AWS_S3_UPLOAD_BUCKET }}
59+
directory: ./artifacts
60+
ids_project_name: magic-nix-cache
61+
ids_binary_prefix: magic-nix-cache
62+
63+
- name: Rename binaries for GH release
6364
run: |
64-
.github/workflows/upload_s3.sh "tag" "$GITHUB_REF_NAME" "$GITHUB_SHA"
65+
mv ./artifacts/{,magic-nix-cache-closure-}ARM64-macOS
66+
mv ./artifacts/{,magic-nix-cache-closure-}X64-macOS
67+
mv ./artifacts/{,magic-nix-cache-closure-}X64-Linux
68+
mv ./artifacts/{,magic-nix-cache-closure-}ARM64-Linux
69+
6570
- name: Publish Release to GitHub (Tag)
6671
uses: softprops/action-gh-release@v1
6772
with:

.github/workflows/upload_s3.sh

Lines changed: 0 additions & 96 deletions
This file was deleted.

flake.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

magic-nix-cache/src/main.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -569,24 +569,23 @@ async fn main_cli(args: Args, recorder: detsys_ids_client::Recorder) -> Result<(
569569

570570
#[tokio::main]
571571
async fn main() -> Result<()> {
572-
let args = Args::parse();
572+
match std::env::var("OUT_PATHS") {
573+
Ok(out_paths) => pbh::handle_legacy_post_build_hook(&out_paths).await,
574+
Err(_) => {
575+
let args = Args::parse();
573576

574-
let (recorder, client_worker) = detsys_ids_client::builder!()
575-
.endpoint(args.diagnostic_endpoint.clone())
576-
.build_or_default()
577-
.await;
577+
let (recorder, client_worker) = detsys_ids_client::builder!()
578+
.endpoint(args.diagnostic_endpoint.clone())
579+
.build_or_default()
580+
.await;
578581

579-
let (ret, _) = tokio::join!(
580-
async move {
581-
match std::env::var("OUT_PATHS") {
582-
Ok(out_paths) => pbh::handle_legacy_post_build_hook(&out_paths).await,
583-
Err(_) => main_cli(args, recorder).await,
584-
}
585-
},
586-
client_worker.wait()
587-
);
582+
let ret = main_cli(args, recorder).await;
583+
584+
client_worker.wait().await;
588585

589-
ret
586+
ret
587+
}
588+
}
590589
}
591590

592591
pub(crate) fn debug_logfile() -> PathBuf {

0 commit comments

Comments
 (0)