Adjust container tags and labels
@@ -24,7 +24,14 @@ jobs:
uses: actions/checkout@v2
- name: Authenticate with GitHub container registry
- run: echo "${{ secrets.CONTAINER_REGISTRY_PERSONAL_ACCESS_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin
+ uses: docker/login-action@v1
+ with:
+ registry: ghcr.io
+ username: lpil
+ password: ${{ secrets.CONTAINER_REGISTRY_PERSONAL_ACCESS_TOKEN }}
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v1
- name: Download Gleam archive from GitHub release
run: |
@@ -42,23 +49,22 @@ jobs:
- name: Build container image
run: docker build --file containers/${{ matrix.base-image }}.dockerfile --tag the-image .
- - name: Push image
- run: |
- IMAGE_ID_BASE=ghcr.io/${{ github.repository }}/gleam-${{ matrix.base-image }}
-
- # Change all uppercase to lowercase
- IMAGE_ID_BASE=$(echo $IMAGE_ID_BASE | 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//')
-
- # Prepare the tag
- TAG=$IMAGE_ID_BASE:$VERSION
- echo TAG=$TAG
+ - name: Prepare container meta information
+ id: container_meta
+ uses: crazy-max/ghaction-docker-meta@v1
+ with:
+ images: ghcr.io/${{ github.repository }}-${{ matrix.base-image }}
+ tag-sha: true
+ tag-semver: |
+ {{version}}
+ {{major}}.{{minor}}
+ {{major}}
- # Push the image to the registry under the tag
- docker tag the-image $TAG
- docker push $TAG
+ - name: Build and push
+ uses: docker/build-push-action@v2
+ with:
+ context: .
+ file: containers/${{ matrix.base-image }}.dockerfile
+ push: true
+ tags: ${{ steps.container_meta.outputs.tags }}
+ labels: ${{ steps.container_meta.outputs.labels }}
