This repository was archived by the owner on Mar 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
149 lines (131 loc) · 5.71 KB
/
build_otp.yml
File metadata and controls
149 lines (131 loc) · 5.71 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Build OTP release
on:
workflow_dispatch:
inputs:
version:
description: 'The OTP version'
required: true
jobs:
ensure_release:
runs-on: ubuntu-18.04
name: "Ensure release (${{ github.event.inputs.version }})"
steps:
- run: gh api -XHEAD repos/erlang/otp/releases/tags/OTP-${{ github.event.inputs.version }}
name: Check erlang/otp
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: check-release
name: Check burrito-elixir/erlang-builder
run: |
if gh api -XHEAD repos/burrito-elixir/erlang-builder/releases/tags/OTP-${{ github.event.inputs.version }}; then
echo ::set-output name=exists::$(echo true)
else
echo ::set-output name=exists::$(echo false)
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
owner: burrito-elixir
repo: erlang-builder
commitish: main
tag_name: OTP-${{ github.event.inputs.version }}
prerelease: ${{ contains(github.event.inputs.version, 'rc') }}
if: ${{ steps.check-release.outputs.exists == 'false' }}
build-musl:
needs: [ensure_release]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04]
steps:
- uses: actions/checkout@v2
- name: Set release name
id: release-name
run: echo ::set-output name=name::otp-${{ github.event.inputs.version }}-$(uname -sm | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
- id: asset-exists
name: Check if release asset exists
run: |
release_id=$(gh api repos/burrito-elixir/erlang-builder/releases/tags/OTP-${{ github.event.inputs.version }} | jq .id)
if gh api repos/burrito-elixir/erlang-builder/releases/${release_id}/assets | jq -r '.[].name' | grep ${{ steps.release-name.outputs.name }}_musl_libc; then
echo ::set-output name=exists::$(echo true)
else
echo ::set-output name=exists::$(echo false)
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
docker build --build-arg version="${{ github.event.inputs.version }}" . -f alpine.Dockerfile -t build-otp-alpine
docker cp $(docker create build-otp-alpine):/tmp/beamup/beamup/${{ steps.release-name.outputs.name }}.tar.gz ./${{ steps.release-name.outputs.name }}.tar.gz
cp ${{ steps.release-name.outputs.name }}.tar.gz ${{ steps.release-name.outputs.name }}_musl_libc.tar.gz
if: ${{ steps.asset-exists.outputs.exists == 'false' }}
- run: gh release upload -R burrito-elixir/erlang-builder OTP-${{ github.event.inputs.version }} ./${{ steps.release-name.outputs.name }}_musl_libc.tar.gz
name: Upload asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ steps.asset-exists.outputs.exists == 'false' }}
build-apple-silicon:
needs: [ensure_release]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-11]
steps:
- uses: actions/checkout@v2
- name: Set release name
id: release-name
run: echo ::set-output name=name::otp-${{ github.event.inputs.version }}-darwin-arm64
- id: asset-exists
name: Check if release asset exists
run: |
release_id=$(gh api repos/burrito-elixir/erlang-builder/releases/tags/OTP-${{ github.event.inputs.version }} | jq .id)
if gh api repos/burrito-elixir/erlang-builder/releases/${release_id}/assets | jq -r '.[].name' | grep ${{ steps.release-name.outputs.name }}; then
echo ::set-output name=exists::$(echo true)
else
echo ::set-output name=exists::$(echo false)
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: APPLE_SILICON=1 TMPDIR=$PWD/tmp ./scripts/build_otp.sh ${{ github.event.inputs.version }}
if: ${{ steps.asset-exists.outputs.exists == 'false' }}
- run: gh release upload -R burrito-elixir/erlang-builder OTP-${{ github.event.inputs.version }} tmp/beamup/${{ steps.release-name.outputs.name }}.tar.gz
name: Upload asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ steps.asset-exists.outputs.exists == 'false' }}
build_standard:
needs: [ensure_release]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04, macos-10.15]
steps:
- uses: actions/checkout@v2
- name: Set release name
id: release-name
run: echo ::set-output name=name::otp-${{ github.event.inputs.version }}-$(uname -sm | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
- id: asset-exists
name: Check if release asset exists
run: |
release_id=$(gh api repos/burrito-elixir/erlang-builder/releases/tags/OTP-${{ github.event.inputs.version }} | jq .id)
if gh api repos/burrito-elixir/erlang-builder/releases/${release_id}/assets | jq -r '.[].name' | grep ${{ steps.release-name.outputs.name }}; then
echo ::set-output name=exists::$(echo true)
else
echo ::set-output name=exists::$(echo false)
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: TMPDIR=$PWD/tmp ./scripts/build_otp.sh ${{ github.event.inputs.version }}
if: ${{ steps.asset-exists.outputs.exists == 'false' }}
- run: gh release upload -R burrito-elixir/erlang-builder OTP-${{ github.event.inputs.version }} tmp/beamup/${{ steps.release-name.outputs.name }}.tar.gz
name: Upload asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ steps.asset-exists.outputs.exists == 'false' }}