Merge pull request #30 from keynslug/fix/release-build #47
Workflow file for this run
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: Release | |
on: | |
push: | |
tags: | |
- "*" | |
workflow_dispatch: | |
inputs: | |
ref: | |
required: false | |
jobs: | |
mac: | |
strategy: | |
fail-fast: false | |
matrix: | |
otp: | |
- 25.3.2-2 | |
- 26.1.2-1 | |
os: | |
- macos-12-arm64 | |
- macos-12 | |
- macos-11 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: prepare | |
run: | | |
brew install curl zip unzip gnu-sed kerl wget | |
git config --global credential.helper store | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: ~/.kerl/${{ matrix.otp }} | |
key: otp-install-${{ matrix.otp }}-${{ matrix.os }} | |
- name: build erlang | |
if: steps.cache.outputs.cache-hit != 'true' | |
timeout-minutes: 60 | |
env: | |
OTP: ${{ matrix.otp }} | |
run: | | |
set -eux | |
if [ ! -d $HOME/.kerl/$OTP ]; then | |
kerl build git https://github.com/emqx/otp.git OTP-$OTP $OTP | |
kerl install $OTP $HOME/.kerl/$OTP | |
fi | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.inputs.ref }} | |
- name: install rebar3 | |
run: | | |
set -eux | |
REBAR=$(brew --prefix)/bin/rebar3 | |
if [ ! -f $REBAR ]; then | |
wget https://s3.amazonaws.com/rebar3/rebar3 -O $REBAR | |
chmod +x $REBAR | |
fi | |
- name: build | |
run: | | |
. $HOME/.kerl/${{ matrix.otp }}/activate | |
BUILD_RELEASE=1 make | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: packages | |
path: | | |
_packages/*.gz | |
_packages/*.gz.sha256 | |
linux: | |
strategy: | |
fail-fast: false | |
matrix: | |
builder: | |
- 5.2-7:1.15.7-25.3.2-2 | |
- 5.2-7:1.15.7-26.1.2-1 | |
arch: | |
- amd64 | |
- arm64 | |
os: | |
- ubuntu22.04 | |
- ubuntu20.04 | |
- ubuntu18.04 | |
- debian12 | |
- debian11 | |
- debian10 | |
- el9 | |
- el8 | |
- el7 | |
- amzn2 | |
- amzn2023 | |
- alpine3.15.1 | |
runs-on: "aws-${{ matrix.arch }}" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.inputs.ref }} | |
submodules: recursive | |
- name: gitconfig | |
run: git config --global --add safe.directory ${PWD} | |
# NOTE: we tried to use build in container, it did not work | |
# so let's stick to the old way for now | |
- name: build | |
env: | |
IMAGE: ghcr.io/emqx/emqx-builder/${{ matrix.builder }}-${{ matrix.os }} | |
run: >- | |
docker run --rm -v ${PWD}:/wd ${IMAGE} bash -euc " | |
git config --global --add safe.directory '*'; | |
make -C /wd BUILD_RELEASE=1 | |
" | |
- uses: actions/upload-artifact@v3 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
name: packages | |
path: | | |
_packages/*.gz | |
_packages/*.gz.sha256 | |
release: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') && github.eventname != 'workflow_dispatch' | |
needs: | |
- mac | |
- linux | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: packages | |
path: packages | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: Erlang Rocksdb NIF ${{ github.ref_name }} Released | |
files: packages/* | |
draft: false | |
prerelease: false |