From f62484a301ab72ca9b8bb4dab7f87d105c74dcc3 Mon Sep 17 00:00:00 2001 From: Erik Martin-Dorel Date: Sun, 12 May 2024 20:56:55 +0200 Subject: [PATCH] docs(README.md): Document PR #90 with an example & Replace TABs with 4xSPC (#93) * emacs: Add file-local-variable `indent-tabs-mode := nil` to avoid inserting further TABs --- .github/workflows/coq-demo.yml | 2 +- README.md | 38 ++++++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coq-demo.yml b/.github/workflows/coq-demo.yml index 78e0284..0b5b36c 100644 --- a/.github/workflows/coq-demo.yml +++ b/.github/workflows/coq-demo.yml @@ -422,7 +422,7 @@ jobs: echo "### $after_ok :rocket:" >> "$GITHUB_STEP_SUMMARY" - name: Next step env: - docker_image: ${{ steps.docker-coq-action.outputs.docker_image}} + docker_image: ${{ steps.docker-coq-action.outputs.docker_image }} run: | : Summary echo "Previous step pulled Docker image: $docker_image" diff --git a/README.md b/README.md index 0f9acf0..81bf9c4 100644 --- a/README.md +++ b/README.md @@ -519,8 +519,8 @@ Instead, you should write one of the following variants: script: | startGroup "Build project" make -j2 - make test - make install + make test + make install endGroup ``` @@ -661,6 +661,36 @@ variables or step outputs to the following steps, or set a Markdown summary. Conversely, the [`export`](#export) keyword can be used to pass variables from the previous step to `docker-coq-action`. +Here is an example of script that uses `GITHUB_ENV` and `GITHUB_OUTPUT`: + + +```yaml +runs-on: ubuntu-latest +strategy: + matrix: + image: + - 'coqorg/coq:latest' + fail-fast: false # don't stop jobs if one fails +steps: + - uses: actions/checkout@v3 + - uses: coq-community/docker-coq-action@v1 + id: docker-coq-action # needed to get step outputs + with: + opam_file: 'folder/coq-proj.opam' + custom_image: ${{ matrix.image }} + after_script: | + # Pass values to upcoming steps in two different ways + echo "coq_version_var=$(opam var coq:version)" >> "$GITHUB_ENV" + echo "coq_version_out=$(opam var coq:version)" >> "$GITHUB_OUTPUT" + - name: Next step + env: + coq_version_var2: ${{ steps.docker-coq-action.outputs.coq_version_out }} + run: | + : Summary + echo "Previous step used: coq_version=$coq_version_var" + echo "Previous step used: coq_version=$coq_version_var2 (same)" +``` + ### Install Debian packages If you use `docker-coq-action` with a @@ -780,3 +810,7 @@ Hence the following two remarks: A comprehensive example of this approach is available in PR [erikmd/docker-coq-github-action-demo#12](https://github.com/erikmd/docker-coq-github-action-demo/pull/12). For completeness, note that masking inputs involved in `workflow_dispatch` may require some `jq`-based workaround, as mentioned in issue [actions/runner#643](https://github.com/actions/runner/issues/643). + + + +