forked from gleam-lang/gleam
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (68 loc) · 2.53 KB
/
release-containers.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: release-containers
on:
release:
types:
- "published"
jobs:
publish-container-images:
name: publish-container-images
runs-on: ubuntu-latest
strategy:
matrix:
base-image:
- erlang
- erlang-slim
- erlang-alpine
- elixir
- elixir-slim
- elixir-alpine
- node
- node-slim
- node-alpine
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Authenticate with GitHub container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: lpil
password: ${{ secrets.CONTAINER_REGISTRY_PERSONAL_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build version and tags
id: versions
run: |
# Strip git ref prefix from version
V_VERSION=$(echo "${{ github.ref }}" | sed -e 's|.*/\(.*\)|\1|')
# Strip `v` prefix from version
BARE_VERSION=$(echo "$V_VERSION" | sed -e 's|^v/\(.*\)|\1|')
# Build version with platform
PLATFORM_VERSION=$BARE_VERSION-${{ matrix.base-image }}
# Build container tag
TAG=ghcr.io/${{ github.repository }}:$PLATFORM_VERSION
echo "v_version=$V_VERSION" >> $GITHUB_OUTPUT
echo "bare_version=$BARE_VERSION" >> $GITHUB_OUTPUT
echo "platform_version=$PLATFORM_VERSION" >> $GITHUB_OUTPUT
echo "container_tag=$TAG" >> $GITHUB_OUTPUT
- name: Download Gleam archive from GitHub release
run: |
VERSION=${{ steps.versions.outputs.v_version }}
URL=https://github.com/${{ github.repository }}/releases/download/$VERSION/gleam-$VERSION-x86_64-unknown-linux-musl.tar.gz
echo Downloading $URL
curl -Lo gleam.tar.gz $URL
- name: Unpack Gleam binary from archive
run: tar xf gleam.tar.gz
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: containers/${{ matrix.base-image }}.dockerfile
push: true
tags: ${{ steps.versions.outputs.container_tag }}
labels: |
org.opencontainers.image.title=gleam
org.opencontainers.image.url=https://gleam.run
org.opencontainers.image.source=https://github.com/gleam-lang/gleam
org.opencontainers.image.version=${{ steps.versions.outputs.platform_version }}
org.opencontainers.image.licenses=Apache-2.0