Skip to content

Commit

Permalink
github action - test wildcard logic
Browse files Browse the repository at this point in the history
  • Loading branch information
techknowlogick committed Feb 5, 2021
1 parent cb8fdd9 commit 0f02d57
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

jobs:
test:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/test_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,23 @@ jobs:
fetch-depth: 2
- name: get golang version 1
run: |
echo ::set-output name=value::$(cat .golang_version | awk -F',' '{print $1}' | sed 's/go1/go-1/')
export VERSION=$(cat .golang_version | awk -F',' '{print $1}' | sed 's/go1/go-1/')
echo ::set-output name=value::$VERSION
DOTS=$(echo -n $VERSION | awk -F"." '{print NF-1}')
if [ "$DOTS" == "1" ]; then
echo ::set-output name=wildcard::$VERSION.x
else
echo ::set-output name=wildcard::$(echo -n $VERSION | sed 's/\.[^.]*$/.x/')
id: golang_version_1
- name: get golang version 2
run: |
echo ::set-output name=value::$(cat .golang_version | awk -F',' '{print $2}' | sed 's/go1/go-1/')
export VERSION=$(cat .golang_version | awk -F',' '{print $2}' | sed 's/go1/go-1/')
echo ::set-output name=value::$VERSION
DOTS=$(echo -n $VERSION | awk -F"." '{print NF-1}')
if [ "$DOTS" == "1" ]; then
echo ::set-output name=wildcard::$VERSION.x
else
echo ::set-output name=wildcard::$(echo -n $VERSION | sed 's/\.[^.]*$/.x/')
id: golang_version_2
- name: get if base should be built
run: |
Expand All @@ -37,14 +49,14 @@ jobs:
uses: docker/build-push-action@v2
with:
context: docker/${{ steps.golang_version_1.outputs.value }}/
tags: techknowlogick/xgo:${{ steps.golang_version_1.outputs.value }}
tags: techknowlogick/xgo:${{ steps.golang_version_1.outputs.value }},techknowlogick/xgo:${{ steps.golang_version_1.outputs.wildcard }}
push: false
file: docker/${{ steps.golang_version_1.outputs.value }}/Dockerfile
- name: build golang ${{ steps.golang_version_2.outputs.value }} image
uses: docker/build-push-action@v2
with:
context: docker/${{ steps.golang_version_2.outputs.value }}/
tags: techknowlogick/xgo${{ steps.golang_version_2.outputs.value }}
tags: techknowlogick/xgo:${{ steps.golang_version_2.outputs.value }},techknowlogick/xgo:${{ steps.golang_version_2.outputs.wildcard }}
push: false
file: docker/${{ steps.golang_version_2.outputs.value }}/Dockerfile
- name: TODO tests
Expand Down

0 comments on commit 0f02d57

Please sign in to comment.