Add JSON output of go env and some env as strings

Additional outputs are:
- GOPATH as `go-path` string
- GOMOD as `go-mod` string
- GOCACHE as `go-cache` string
- GOMODCACHE as `go-mod-cache` string
- `go env` as `go-env` JSON
This commit is contained in:
Luca Comellini 2023-02-15 16:16:09 -08:00
parent c4c1141886
commit 18710d65d4
No known key found for this signature in database
GPG key ID: 4850B36E838507C6
5 changed files with 112 additions and 12 deletions

24
.github/workflows/outputs.yml vendored Normal file
View file

@ -0,0 +1,24 @@
name: Test outputs
on:
push:
branches:
- main
pull_request:
jobs:
setup-go-env:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: setup-go
uses: ./
- run: |
echo GOPATH=${{ steps.setup-go.outputs.go-path }}
echo GOMOD=${{ steps.setup-go.outputs.go-mod }}
echo GOMODCACHE=${{ steps.setup-go.outputs.go-mod-cache }}
echo GOVERSION=${{ steps.setup-go.outputs.go-version }}
echo GOCACHE=${{ steps.setup-go.outputs.go-cache }}
echo Go environment variables json:
jq . <<< '${{ steps.setup-go.outputs.go-env }}'