-
Notifications
You must be signed in to change notification settings - Fork 5
146 lines (123 loc) · 4.39 KB
/
build-new-release.yml
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
name: Build New OTP Release
on:
release:
types: [created]
jobs:
cache-docker-images:
name: Cache Stacks
runs-on: ubuntu-latest
strategy:
matrix:
stack:
- 20
- 22
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker Caching
uses: satackey/[email protected]
continue-on-error: true
with:
key: heroku-${{ matrix.stack }}
- name: Build Heroku Stack Image
run: docker build -t heroku-${{ matrix.stack }} - < stacks/heroku-${{ matrix.stack }}.Dockerfile
download-otp:
name: Download OTP Source
runs-on: ubuntu-latest
steps:
- name: Get OTP Version
id: otp-version
run: |
echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
- name: Download OTP Source
run: wget https://github.com/erlang/otp/archive/OTP-${{ steps.otp-version.outputs.version }}.tar.gz
- name: Save OTP Source
uses: actions/upload-artifact@v3
with:
name: otp-source
path: OTP-${{ steps.otp-version.outputs.version }}.tar.gz
- name: Update Release
id: update_release
uses: tubone24/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
with:
upload_url: ${{ steps.update_release.outputs.upload_url }}
asset_path: OTP-${{ steps.otp-version.outputs.version }}.tar.gz
asset_name: OTP-${{ steps.otp-version.outputs.version }}.tar.gz
asset_content_type: application/gzip
build:
name: Build OTP for Heroku ${{ matrix.stack }}
needs: [cache-docker-images, download-otp]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
stack:
- 20
- 22
steps:
- uses: actions/checkout@v3
- name: Get OTP Version
id: otp-version
run: |
echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
- name: Get OTP Source
uses: actions/download-artifact@v3
with:
name: otp-source
- name: Setup OTP Build
env:
OTP: ${{ steps.otp-version.outputs.version }}
run: |
mkdir -p build/mount/otp-release-files
mv OTP-$OTP.tar.gz build/
cd build
tar -zxf OTP-$OTP.tar.gz
mv otp-OTP-$OTP/ mount/
- name: Docker Caching
uses: satackey/[email protected]
continue-on-error: true
with:
key: heroku-${{ matrix.stack }}
- name: Build Heroku Stack Image
env:
STACK: ${{ matrix.stack }}
run: docker build -t heroku-$STACK - < stacks/heroku-$STACK.Dockerfile
- name: Build OTP
working-directory: build
env:
OTP: ${{ steps.otp-version.outputs.version }}
STACK: ${{ matrix.stack }}
run: |
docker run -v $(pwd)/mount:/build -w /build/otp-OTP-$OTP heroku-$STACK ./otp_build autoconf
docker run -v $(pwd)/mount:/build -w /build/otp-OTP-$OTP heroku-$STACK ./configure --with-ssl --enable-dirty-schedulers
docker run -v $(pwd)/mount:/build -w /build/otp-OTP-$OTP heroku-$STACK make
docker run -v $(pwd)/mount:/build -w /build/otp-OTP-$OTP heroku-$STACK make RELEASE_ROOT=/build/otp-release-files release
docker run -v $(pwd)/mount:/build -w /build/otp-OTP-$OTP heroku-$STACK chmod -R 777 /build/otp-release-files
- name: Create Tarball
working-directory: build
env:
OTP: ${{ steps.otp-version.outputs.version }}
run: |
mkdir out
mv mount/otp-release-files/ OTP-$OTP
tar -zcf out/OTP-$OTP.tar.gz OTP-$OTP
- name: Update Release
id: update_release
uses: tubone24/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
with:
upload_url: ${{ steps.update_release.outputs.upload_url }}
asset_path: build/out/OTP-${{ steps.otp-version.outputs.version }}.tar.gz
asset_name: heroku-${{ matrix.stack }}.tar.gz
asset_content_type: application/gzip