@@ -33,35 +33,46 @@ jobs:
33
33
- name : Set up Docker Buildx
34
34
uses : docker/setup-buildx-action@v1
35
35
36
- - name : Download Gleam archive from GitHub release
36
+ - name : Build version and tags
37
+ id : versions
37
38
run : |
38
39
# Strip git ref prefix from version
39
- VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
40
+ V_VERSION=$(echo "${{ github.ref }}" | sed -e 's|.*/\(.*\)|\1|')
41
+
42
+ # Strip `v` prefix from version
43
+ BARE_VERSION=$(echo "$V_VERSION" | sed -e 's|^v/\(.*\)|\1|')
44
+
45
+ # Build version with platform
46
+ PLATFORM_VERSION=$BARE_VERSION-${{ matrix.base-image }}
47
+
48
+ # Build container tag
49
+ TAG=ghcr.io/${{ github.repository }}:$PLATFORM_VERSION
50
+
51
+ echo "::set-output name=v_version::$V_VERSION"
52
+ echo "::set-output name=bare_version::$BARE_VERSION"
53
+ echo "::set-output name=platform_version::$PLATFORM_VERSION"
54
+ echo "::set-output name=container_tag::$TAG"
40
55
41
- # Download archive
56
+ - name : Download Gleam archive from GitHub release
57
+ run : |
58
+ VERSION=${{ steps.versions.outputs.v_version }}
42
59
URL=https://github.com/${{ github.repository }}/releases/download/$VERSION/gleam-$VERSION-linux-amd64.tar.gz
43
60
echo Downloading $URL
44
61
curl -Lo gleam.tar.gz $URL
45
62
46
63
- name : Unpack Gleam binary from archive
47
64
run : tar xf gleam.tar.gz
48
65
49
- - name : Prepare container meta information
50
- id : container_meta
51
- uses : crazy-max/ghaction-docker-meta@v1
52
- with :
53
- images : ghcr.io/${{ github.repository }}
54
- tag-sha : true
55
- tag-latest : false
56
- tag-semver : |
57
- {{version}}-${{ matrix.base-image }}
58
- {{major}}.{{minor}}-${{ matrix.base-image }}
59
-
60
66
- name : Build and push
61
67
uses : docker/build-push-action@v2
62
68
with :
63
69
context : .
64
70
file : containers/${{ matrix.base-image }}.dockerfile
65
71
push : true
66
- tags : ${{ steps.container_meta.outputs.tags }}
67
- labels : ${{ steps.container_meta.outputs.labels }}
72
+ tags : ${{ steps.versions.outputs.container_tag }}
73
+ labels : |
74
+ org.opencontainers.image.title=gleam
75
+ org.opencontainers.image.url=https://gleam.run
76
+ org.opencontainers.image.source=https://github.com/gleam-lang/gleam
77
+ org.opencontainers.image.version=${{ steps.versions.outputs.platform_version }}
78
+ org.opencontainers.image.licenses=Apache-2.0
0 commit comments