add OTP-27.0-rc1, update OTP-26.2.2, OTP-25.3.2.9, OTP-24.3.4.14 #162
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Images | |
on: | |
push: | |
pull_request: | |
branches: [ $default-branch ] | |
workflow_dispatch: | |
jobs: | |
matrix: | |
runs-on: ubuntu-22.04 | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
id: set-matrix | |
run: | | |
matrix=$(jq -c '{"otp" : .otp | keys}' versions.json) | |
echo "Matrix: $matrix" | |
echo "matrix=$matrix" >> $GITHUB_OUTPUT | |
images: | |
needs: matrix | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }} | |
fail-fast: false | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Choose Repository | |
id: repo | |
run: | | |
case ${{ github.ref }} in | |
refs/heads/master) | |
echo "project=alpine-erlang" >> $GITHUB_OUTPUT | |
;; | |
*) | |
echo "project=alpine-erlang-dev" >> $GITHUB_OUTPUT | |
;; | |
esac | |
- | |
name: Load Env | |
id: load-env | |
run: | | |
load=$(jq -cr '{"OTP_MAJOR": "${{ matrix.otp }}"} * (.otp."${{ matrix.otp }}" | with_entries(.key |= "OTP_" + ascii_upcase)) * (.rebar3."\(.otp."${{ matrix.otp }}".rebar3)" | with_entries(.key |= "REBAR3_" + ascii_upcase))' versions.json) | |
tag=$(echo $load | jq -cr ".OTP_VERSION + \":\" + .REBAR3_VERSION + \":$GITHUB_RUN_ID\"" | sha256sum | cut -b -7) | |
load=$(echo "$load" | jq -cr ". + {\"TAG\":\"$tag\"}") | |
echo "env=$load" >> $GITHUB_OUTPUT | |
- | |
name: Docker Metadata | |
env: ${{ fromJson(steps.load-env.outputs.env) }} | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
quay.io/travelping/${{ steps.repo.outputs.project }} | |
tags: | | |
type=raw,value=${{ env.TAG }} | |
type=raw,value=${{ env.OTP_MAJOR }} | |
type=raw,value=${{ env.OTP_VERSION }} | |
- | |
name: Install Packages | |
run: | | |
sudo apt update | |
sudo apt full-upgrade -y | |
sudo apt install qemu-user-static buildah podman | |
- | |
name: Build Image | |
env: ${{ fromJson(steps.load-env.outputs.env) }} | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
build-args: | | |
ALPINE_VERSION=alpine:${{ env.OTP_ALPINE }} | |
OTP_VERSION=${{ env.OTP_VERSION }} | |
OTP_DOWNLOAD_SHA256=${{ env.OTP_DOWNLOAD_SHA256 }} | |
REBAR3_VERSION=${{ env.REBAR3_VERSION }} | |
REBAR3_DOWNLOAD_SHA256=${{ env.REBAR3_DOWNLOAD_SHA256 }} | |
image: ${{ steps.meta.outputs.images }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64 | |
# building Erlang/OTP 25.0 for arm64 on QEMU user emulation is broken, | |
# see https://erlangforums.com/t/otp-25-0-rc3-release-candidate-3-is-released/1317/24 | |
# platforms: linux/amd64,linux/arm64 | |
containerfiles: | | |
./Containerfile | |
- | |
name: Check images created | |
run: buildah images | |
- | |
name: Push To Harbor | |
id: push-to-harbor | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build-image.outputs.image }} | |
tags: ${{ steps.build-image.outputs.tags }} | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_TOKEN }} | |
- | |
name: Print image url | |
run: echo "Image pushed to ${{ steps.push-to-harbor.outputs.registry-paths }}" |