Skip to content

Commit d8b29c8

Browse files
committed
Add release pipeline
1 parent 4b35f7e commit d8b29c8

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

.github/workflows/push-release.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: release
2+
3+
# trigger on published release
4+
on:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Check out the repo
14+
uses: actions/checkout@v2
15+
16+
- name: Lint Dockerfile
17+
uses: brpaz/hadolint-action@master
18+
with:
19+
dockerfile: "Dockerfile"
20+
21+
build_push_release:
22+
runs-on: ubuntu-latest
23+
needs: lint
24+
25+
strategy:
26+
matrix:
27+
tf_version:
28+
- "0.12.29"
29+
- "0.13.5"
30+
- "0.14.0"
31+
32+
azcli_version:
33+
- "2.15.1"
34+
35+
env:
36+
ORGANIZATION: "smerrell"
37+
IMAGE_NAME: "terraform-python-build"
38+
39+
steps:
40+
- name: Check out the repo
41+
uses: actions/checkout@v2
42+
43+
- name: Login to Docker Hub
44+
uses: docker/login-action@v1
45+
with:
46+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
47+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
48+
49+
- name: Get and save release tag
50+
run: echo "RELEASE_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
51+
52+
- name: Build and save image release tag
53+
run: echo "IMAGE_RELEASE_TAG=release-${RELEASE_TAG}_terraform-${{ matrix.tf_version }}_azcli-${{ matrix.azcli_version }}" >> $GITHUB_ENV
54+
55+
- name: Build image
56+
run: docker image build . --file Dockerfile --build-arg TF_AZ_CLI_VERSION=release-5.1_terraform-${{ matrix.tf_version }}_azcli${{ matrix.azcli_version }} --tag ${ORGANIZATION}/${IMAGE_NAME}:${IMAGE_RELEASE_TAG}
57+
58+
- name: Push image to registry
59+
run: docker push ${ORGANIZATION}/${IMAGE_NAME}:${IMAGE_RELEASE_TAG}

0 commit comments

Comments
 (0)