-
Notifications
You must be signed in to change notification settings - Fork 9
refactor github action upload flow #340
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| name: Build and upload arch-specific binary | ||
| description: Builds a Rust binary for a specific CPU architecture and uploads it to GCS. | ||
|
|
||
| inputs: | ||
| arch: | ||
| description: CPU architecture target (e.g. znver5, sapphirerapids) | ||
| required: true | ||
| binary_name: | ||
| description: Binary crate name with hyphens (e.g. stwo-run-and-prove) | ||
| required: true | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Setup environment variables | ||
| shell: bash | ||
| env: | ||
| BINARY_NAME_ORIGINAL: ${{ inputs.binary_name }} | ||
| ARCH_NAME: ${{ inputs.arch }} | ||
| run: | | ||
| echo "BINARY_NAME_ORIGINAL=${BINARY_NAME_ORIGINAL}" >> $GITHUB_ENV | ||
| echo "BINARY_NAME_DEST=${BINARY_NAME_ORIGINAL//-/_}" >> $GITHUB_ENV | ||
| echo "ARCH_NAME=${ARCH_NAME}" >> $GITHUB_ENV | ||
|
|
||
| - name: Build ${{ env.BINARY_NAME_ORIGINAL }} for ${{ env.ARCH_NAME }} | ||
| shell: bash | ||
| run: | | ||
| CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C target-cpu=${{ env.ARCH_NAME }}" \ | ||
| cargo build --release --target x86_64-unknown-linux-gnu --bin ${{ env.BINARY_NAME_ORIGINAL }} | ||
|
|
||
| - name: Rename ${{ env.BINARY_NAME_ORIGINAL }} to ${{ env.BINARY_NAME_DEST }} (${{ env.ARCH_NAME }}) | ||
| shell: bash | ||
| run: | | ||
| mv "target/x86_64-unknown-linux-gnu/release/${{ env.BINARY_NAME_ORIGINAL }}" \ | ||
| "target/x86_64-unknown-linux-gnu/release/${{ env.BINARY_NAME_DEST }}" | ||
|
|
||
| - name: Upload ${{ env.BINARY_NAME_DEST }} (${{ env.ARCH_NAME }}) to GCP | ||
| uses: google-github-actions/upload-cloud-storage@v2 | ||
| with: | ||
| path: "target/x86_64-unknown-linux-gnu/release/${{ env.BINARY_NAME_DEST }}" | ||
| destination: "${{ env.BINARY_NAME_DEST }}_${{ env.ARCH_NAME }}_artifacts/${{ env.SHORT_HASH }}/release" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Composite action has undeclared dependency on
|
||


Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using variable interpolation${{...}}withgithubcontext data in arun:step could allow an attacker to inject their own code into the runner. This would allow them to steal secrets and code.githubcontext data can have arbitrary user input and should be treated as untrusted. Instead, use an intermediate environment variable withenv:to store the data and use the environment variable in therun:script. Be sure to use double-quotes the environment variable, like this: "$ENVVAR".🥳 Fixed in commit 4b9d4a7 🥳