Skip to content

Commit

Permalink
workflow: read OPA version from go.mod
Browse files Browse the repository at this point in the history
Signed-off-by: Stephan Renatus <stephan@styra.com>
  • Loading branch information
srenatus committed Nov 4, 2024
1 parent 0e950b7 commit 67bea25
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ jobs:
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version-file: go.mod
- id: opa
name: read version
run: echo "version=$(go list -m -f '{{.Version}}' github.com/open-policy-agent/opa)" >> $GITHUB_OUTPUT
- uses: open-policy-agent/setup-opa@34a30e8a924d1b03ce2cf7abe97250bbb1f332b5 # v2.2.0
with:
version: v0.70.0
version: ${{ steps.opa.outputs.version }}
static: ${{ matrix.os.static }}
- run: npm install --prefix build
- name: Restore rq cache
Expand Down Expand Up @@ -74,9 +77,12 @@ jobs:
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version-file: go.mod
- id: opa
name: read version
run: echo "version=$(go list -m -f '{{.Version}}' github.com/open-policy-agent/opa)" >> $GITHUB_OUTPUT
- uses: open-policy-agent/setup-opa@34a30e8a924d1b03ce2cf7abe97250bbb1f332b5 # v2.2.0
with:
version: v0.70.0
version: ${{ steps.opa.outputs.version }}
- run: |
go run main.go test --coverage bundle \
| opa eval -f raw -I -d build/simplecov/simplecov.rego data.build.simplecov.from_opa \
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/update-example-index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- uses: open-policy-agent/setup-opa@34a30e8a924d1b03ce2cf7abe97250bbb1f332b5 # v2.2.0
with:
version: v0.68.0
static: true

- name: Set up go for rq
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version-file: go.mod

- id: opa
name: read version
run: echo "version=$(go list -m -f '{{.Version}}' github.com/open-policy-agent/opa)" >> $GITHUB_OUTPUT
- uses: open-policy-agent/setup-opa@34a30e8a924d1b03ce2cf7abe97250bbb1f332b5 # v2.2.0
with:
version: ${{ steps.opa.outputs.version }}
static: true
- name: Restore rq cache
id: cache-rq
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
Expand Down

0 comments on commit 67bea25

Please sign in to comment.