Skip to content

Commit 4672f9b

Browse files
authored
Merge pull request #40 from id/ci-build-packages-for-more-platforms
ci: build packages for more platforms
2 parents d1590c7 + ef44d5e commit 4672f9b

File tree

1 file changed

+34
-10
lines changed

1 file changed

+34
-10
lines changed

.github/workflows/release.yaml

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ on:
44
push:
55
tags:
66
- "*"
7+
workflow_dispatch:
8+
inputs:
9+
branch_or_tag:
10+
required: false
11+
is_release:
12+
required: false
13+
default: false
14+
715
jobs:
816
mac:
917
strategy:
@@ -15,12 +23,14 @@ jobs:
1523
os:
1624
- macos-11
1725
- macos-12
26+
- macos-12-arm64
1827
runs-on: ${{ matrix.os }}
1928
steps:
2029
- uses: actions/checkout@v3
2130
with:
2231
submodules: recursive
2332
fetch-depth: 0
33+
ref: ${{ github.event.inputs.branch_or_tag }} # when input is not given, the event tag is used
2434

2535
- name: Configure Homebrew cache
2636
uses: actions/cache@v3
@@ -36,18 +46,22 @@ jobs:
3646
# brew update
3747
brew install curl zip unzip gnu-sed automake bison
3848
brew install erlang@${{ matrix.otp }}
39-
echo "/usr/local/bin" >> $GITHUB_PATH
49+
echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH
50+
echo "$(brew --prefix erlang@${{ matrix.otp }})/bin" >> $GITHUB_PATH
4051
git config --global credential.helper store
4152
53+
- name: build
54+
if: ! startsWith(github.ref, 'refs/tags/') || inputs.is_release == false
55+
run: |
56+
./build.sh
57+
4258
- name: build release
43-
if: startsWith(github.ref, 'refs/tags/')
59+
if: startsWith(github.ref, 'refs/tags/') || inputs.is_release == true
4460
run: |
45-
export PATH="/usr/local/opt/bison/bin:$PATH"
46-
export PATH="/usr/local/opt/erlang@${{ matrix.otp }}/bin:$PATH"
4761
env BUILD_RELEASE=1 ./build.sh
4862
4963
- uses: actions/upload-artifact@v3
50-
if: startsWith(github.ref, 'refs/tags/')
64+
if: startsWith(github.ref, 'refs/tags/') || inputs.is_release == true
5165
with:
5266
name: packages
5367
path: |
@@ -59,46 +73,56 @@ jobs:
5973
fail-fast: false
6074
matrix:
6175
builder:
62-
- 5.0-26
76+
- 5.0-32
6377
otp:
64-
- 24.3.4.2-1
78+
- 24.3.4.2-2
6579
- 25.1.2-2
6680
elixir:
6781
- 1.13.4
6882
arch:
6983
- amd64
7084
- arm64
7185
os:
86+
- ubuntu22.04
7287
- ubuntu20.04
7388
- ubuntu18.04
7489
- ubuntu16.04
7590
- debian11
7691
- debian10
7792
- debian9
93+
- amzn2
7894
- el7
7995
- el8
96+
- el9
8097
- alpine3.15.1
8198
runs-on: ubuntu-latest
8299

83100
steps:
84101
- uses: actions/checkout@v3
85102
with:
86103
fetch-depth: 0
104+
ref: ${{ github.event.inputs.branch_or_tag }} # when input is not given, the event tag is used
87105

88106
- uses: docker/setup-buildx-action@v2
89107

90108
- uses: docker/setup-qemu-action@v2
91109
with:
92110
platforms: ${{ matrix.arch }}
93111

112+
- name: build
113+
if: ! startsWith(github.ref, 'refs/tags/') || inputs.is_release == false
114+
run: |
115+
IMAGE=ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}
116+
docker run -i --rm --user 1001 -v $(pwd):/wd --workdir /wd --platform=linux/${{ matrix.arch }} $IMAGE bash -euc './build.sh'
117+
94118
- name: build release
95-
if: startsWith(github.ref, 'refs/tags/')
119+
if: startsWith(github.ref, 'refs/tags/') || inputs.is_release == true
96120
run: |
97121
IMAGE=ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}
98122
docker run -i --rm --user 1001 -v $(pwd):/wd --workdir /wd --platform=linux/${{ matrix.arch }} -e BUILD_RELEASE=1 $IMAGE bash -euc './build.sh'
99123
100124
- uses: actions/upload-artifact@v3
101-
if: startsWith(github.ref, 'refs/tags/')
125+
if: startsWith(github.ref, 'refs/tags/') || inputs.is_release == true
102126
with:
103127
name: packages
104128
path: |
@@ -110,7 +134,7 @@ jobs:
110134
needs:
111135
- mac
112136
- linux
113-
if: startsWith(github.ref, 'refs/tags/')
137+
if: startsWith(github.ref, 'refs/tags/') || inputs.is_release == true
114138
steps:
115139
- uses: actions/download-artifact@v3
116140
with:

0 commit comments

Comments
 (0)