mirror of
https://github.com/gleam-lang/gleam.git
synced 2025-12-23 09:47:08 +00:00
80 lines
2.5 KiB
YAML
80 lines
2.5 KiB
YAML
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@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: 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 "::set-output name=v_version::$V_VERSION"
|
|
echo "::set-output name=bare_version::$BARE_VERSION"
|
|
echo "::set-output name=platform_version::$PLATFORM_VERSION"
|
|
echo "::set-output name=container_tag::$TAG"
|
|
|
|
- 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-linux-amd64.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@v2
|
|
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
|