Skip to content

Commit ee39ac5

Browse files
authored
Merge pull request #92 from cisagov/improvement/use_action_outputs
Use Outputs of cisagov/setup-env-github-action to Control Installed Program Versions
2 parents ff73498 + 8797e11 commit ee39ac5

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,23 @@ jobs:
1717
lint:
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: cisagov/setup-env-github-action@develop
20+
- id: setup-env
21+
uses: cisagov/setup-env-github-action@develop
2122
- uses: actions/checkout@v2
2223
- id: setup-python
2324
uses: actions/setup-python@v2
2425
with:
2526
python-version: 3.9
26-
# GO_VERSION and GOCACHE are used by the cache task, so the Go
27-
# installation must happen before that.
27+
# We need the Go version and Go cache location for the actions/cache step,
28+
# so the Go installation must happen before that.
2829
- uses: actions/setup-go@v2
2930
with:
3031
go-version: '1.16'
3132
- name: Store installed Go version
33+
id: go-version
3234
run: |
33-
echo "GO_VERSION="\
34-
"$(go version | sed 's/^go version go\([0-9.]\+\) .*/\1/')" \
35-
>> $GITHUB_ENV
35+
echo "::set-output name=version::"\
36+
"$(go version | sed 's/^go version go\([0-9.]\+\) .*/\1/')"
3637
- name: Lookup Go cache directory
3738
id: go-cache
3839
run: |
@@ -41,9 +42,9 @@ jobs:
4142
env:
4243
BASE_CACHE_KEY: "${{ github.job }}-${{ runner.os }}-\
4344
py${{ steps.setup-python.outputs.python-version }}-\
44-
go${{ env.GO_VERSION }}-\
45-
packer${{ env.PACKER_VERSION }}-\
46-
tf${{ env.TERRAFORM_VERSION }}-"
45+
go${{ steps.go-version.outputs.version }}-\
46+
packer${{ steps.setup-env.outputs.packer-version }}-\
47+
tf${{ steps.setup-env.outputs.terraform-version }}-"
4748
with:
4849
# Note that the .terraform directory IS NOT included in the
4950
# cache because if we were caching, then we would need to use
@@ -65,6 +66,8 @@ jobs:
6566
- name: Setup curl cache
6667
run: mkdir -p ${{ env.CURL_CACHE_DIR }}
6768
- name: Install Packer
69+
env:
70+
PACKER_VERSION: ${{ steps.setup-env.outputs.packer-version }}
6871
run: |
6972
PACKER_ZIP="packer_${PACKER_VERSION}_linux_amd64.zip"
7073
curl --output ${{ env.CURL_CACHE_DIR }}/"${PACKER_ZIP}" \
@@ -77,13 +80,17 @@ jobs:
7780
sudo ln -s /opt/packer/packer /usr/local/bin/packer
7881
- uses: hashicorp/setup-terraform@v1
7982
with:
80-
terraform_version: ${{ env.TERRAFORM_VERSION }}
83+
terraform_version: ${{ steps.setup-env.outputs.terraform-version }}
8184
- name: Install shfmt
82-
run: go install mvdan.cc/sh/v3/cmd/shfmt@${SHFMT_VERSION}
85+
env:
86+
PACKAGE_URL: mvdan.cc/sh/v3/cmd/shfmt
87+
PACKAGE_VERSION: ${{ steps.setup-env.outputs.shfmt-version }}
88+
run: go install ${PACKAGE_URL}@${PACKAGE_VERSION}
8389
- name: Install Terraform-docs
84-
run: |
85-
go install \
86-
github.com/terraform-docs/terraform-docs@${TERRAFORM_DOCS_VERSION}
90+
env:
91+
PACKAGE_URL: github.com/terraform-docs/terraform-docs
92+
PACKAGE_VERSION: ${{ steps.setup-env.outputs.terraform-docs-version }}
93+
run: go install ${PACKAGE_URL}@${PACKAGE_VERSION}
8794
- name: Install dependencies
8895
run: |
8996
python -m pip install --upgrade pip

0 commit comments

Comments
 (0)