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

Add env.BUILD_OPTS #9

Merged
merged 8 commits into from Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Expand Up @@ -143,6 +143,16 @@ Make sure you store the yml files shown below in your repository under `.github/
${{ steps.srtool_build.outputs.wasm }}
${{ matrix.chain }}-srtool-digest.json

## Environmental variables
```
...
uses: chevdor/srtool-actions@v*
env:
BUILD_OPTS: "--features on-chain-release-build" # optional: will be passed to docker srtool run cmd
with:
...
```

## Dev notes

Due to a [bug in act](https://github.com/nektos/act/issues/655), the defaults defined in the action are not applied. That means **must** pass all the inputs while testing with `act`.
Expand Down
13 changes: 13 additions & 0 deletions README_src.adoc
Expand Up @@ -47,3 +47,16 @@ If your project uses standard values (such as your runtime package being named `
include::examples/index.adoc[leveloffset=+1]

include::doc/dev-notes.adoc[]

== Environmental variables

[source,bash]
----
...
uses: chevdor/srtool-actions@v*
env:
# optional: will be passed to docker srtool run cmd
BUILD_OPTS: "--features on-chain-release-build"
with:
...
----
5 changes: 4 additions & 1 deletion action.yml
Expand Up @@ -115,6 +115,8 @@ runs:
PACKAGE=${PACKAGE:-${{ inputs.chain }}'-runtime'}
echo "PACKAGE=$PACKAGE" >> $GITHUB_ENV

echo "BUILD_OPTS=${{ env.BUILD_OPTS }}" >> $GITHUB_ENV

echo ::endgroup

- id: env_check
Expand All @@ -129,6 +131,7 @@ runs:
echo ℹ️ package: ${{ env.PACKAGE }}
echo ℹ️ workdir: ${{ env.WORKDIR }}
echo ℹ️ runtime_dir: ${{ env.RUNTIME_DIR }}
echo ℹ️ build_opts: ${{ env.BUILD_OPTS }}
echo ℹ️ .git folder: `ls -ald ${{ env.WORKDIR }}/.git`
echo ℹ️ Cargo.toml: `ls -al ${{ env.WORKDIR }}/Cargo.toml`

Expand Down Expand Up @@ -167,7 +170,7 @@ runs:
shell: bash
run: |
echo ::group::Srtool build of chain ${{ inputs.chain }}
CMD="docker run -i --rm -e PACKAGE=${{ env.PACKAGE }} -e RUNTIME_DIR=${{ env.RUNTIME_DIR }} -v ${{ env.WORKDIR }}:/build ${{ env.SRTOOL_IMAGE }} build --app --json -cM"
CMD="docker run -i --rm -e PACKAGE=${{ env.PACKAGE }} -e RUNTIME_DIR=${{ env.RUNTIME_DIR }} -e BUILD_OPTS -v ${{ env.WORKDIR }}:/build ${{ env.SRTOOL_IMAGE }} build --app --json -cM"
chevdor marked this conversation as resolved.
Show resolved Hide resolved
echo ::debug::build::docker_run $CMD

# here we keep streaming the progress and fetch the last line for the json result
Expand Down