Skip to content

Commit

Permalink
Add env.BUILD_OPTS (#9)
Browse files Browse the repository at this point in the history
* add build_opts env

* update docker cmd to use local BUILD_OPTS env

* update readme

* update docs
  • Loading branch information
ermalkaleci committed Apr 28, 2022
1 parent 23c461c commit 7531320
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
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"
echo ::debug::build::docker_run $CMD
# here we keep streaming the progress and fetch the last line for the json result
Expand Down

0 comments on commit 7531320

Please sign in to comment.