From ab74f5d79f7e54a724bbd34160aa2a17d8efd234 Mon Sep 17 00:00:00 2001 From: adamus1red Date: Tue, 26 May 2020 18:37:34 +0100 Subject: [PATCH] Update dockerpublish.yml (#4) * Update dockerpublish.yml * add alts to tests --- .github/workflows/dockerpublish.yml | 94 +++++++++++++++++++++++++++-- 1 file changed, 90 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dockerpublish.yml b/.github/workflows/dockerpublish.yml index dd47bbe..2f253c0 100644 --- a/.github/workflows/dockerpublish.yml +++ b/.github/workflows/dockerpublish.yml @@ -33,6 +33,9 @@ jobs: docker-compose --file docker-compose.test.yml run sut else docker build . --file Dockerfile + docker build . --file Dockerfile.mainline + docker build . --file Dockerfile.alpine + docker build . --file Dockerfile.mainline.alpine fi # Push image to GitHub Packages. @@ -47,13 +50,96 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Build image - run: docker build . --file Dockerfile --tag $IMAGE_NAME - + - name: Build Stable + run: docker build . --file Dockerfile --tag stable + + - name: Build Mainline + run: docker build . --file Dockerfile.mainline --tag mainline + + - name: Build Stable + run: docker build . --file Dockerfile.alpine --tag stable-alpine + + - name: Build Mainline + run: docker build . --file Dockerfile.mainline.alpine --tag mainline-alpine + - name: Log into registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin - - name: Push image + - name: Push stable + env: + IMAGE_NAME: stable + run: | + IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME + + # Change all uppercase to lowercase + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + + # Strip git ref prefix from version + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + + # Strip "v" prefix from tag name + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + + # Use Docker `latest` tag convention + [ "$VERSION" == "master" ] && VERSION=latest + + echo IMAGE_ID=$IMAGE_ID + echo VERSION=$VERSION + + docker tag $IMAGE_NAME $IMAGE_ID:$VERSION + docker push $IMAGE_ID:$VERSION + + - name: Push Mainline + env: + IMAGE_NAME: mainline + run: | + IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME + + # Change all uppercase to lowercase + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + + # Strip git ref prefix from version + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + + # Strip "v" prefix from tag name + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + + # Use Docker `latest` tag convention + [ "$VERSION" == "master" ] && VERSION=latest + + echo IMAGE_ID=$IMAGE_ID + echo VERSION=$VERSION + + docker tag $IMAGE_NAME $IMAGE_ID:$VERSION + docker push $IMAGE_ID:$VERSION + + - name: Push stable + env: + IMAGE_NAME: stable-alpine + run: | + IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME + + # Change all uppercase to lowercase + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + + # Strip git ref prefix from version + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + + # Strip "v" prefix from tag name + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + + # Use Docker `latest` tag convention + [ "$VERSION" == "master" ] && VERSION=latest + + echo IMAGE_ID=$IMAGE_ID + echo VERSION=$VERSION + + docker tag $IMAGE_NAME $IMAGE_ID:$VERSION + docker push $IMAGE_ID:$VERSION + + - name: Push Mainline + env: + IMAGE_NAME: mainline-alpine run: | IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME