-
Notifications
You must be signed in to change notification settings - Fork 33
162 lines (124 loc) · 5.67 KB
/
release_artifacts.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# MATRIX NOTES:
# At the time of this writing, Github Actions YAML does not allow for the declaration and sharing of variables
# across different jobs "easily". For example, the 'pg_version' strategy.matrix variable needs to be the same
# across all jobs, but at this time there is no way to declare an array of anything once and share it across
# several jobs.
# Therefore, any time a change is needed to strategy.matrix.pg_version (such as the case of adding or removing
# a new version of Postgres), it needs to be changed everywhere in this file as well.
name: Build release artifacts
# workflow_dispatch is also included here so that we can run this workflow at any time against a specific branch/tag
on:
release:
types: [published]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
x86_64_deb_artifacts:
name: Build x86_64 Debian artifacts
runs-on: ubuntu-latest
strategy:
matrix:
pg_version: [pg13, pg14, pg15, pg16] # See MATRIX NOTES above
fail-fast: false
permissions:
contents: write
steps:
- uses: actions/checkout@v3
# The default installation of Docker on Github Actions runners are pretty outdated, as the artifact builder
# Dockerfiles require a newer version of Docker that has heredoc support. This may not be necesssary in the future,
# but it is definitely needed at the time of this writing.
- name: Install newer version of Docker
run: |
echo "-- Remove existing installations of Docker --"
sudo apt-get remove docker docker-engine docker.io containerd runc
echo "-- Install new version -- "
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- name: Build and extract Debian .deb artifact via Docker
run: |
echo "-- Setting variables --"
export PG_VER=$(echo ${{ matrix.pg_version}} | cut -c 3-)
export PLRUST_VER=$( echo "${{ github.ref_name }}" | sed -e s/^v// )
echo "-- Building artifact via Docker --"
docker build \
--build-arg PG_VER=$PG_VER \
--build-arg PLRUST_VER=$PLRUST_VER\
-f .github/docker/Dockerfile.debian-artifact-build \
-t plrust-debian \
.
echo "-- Creating container --"
container_id=$(docker create plrust-debian)
echo "-- Extracting file from container --"
docker cp $container_id:/out /home/runner
echo "-- Destroying container --"
docker rm -v $container_id
- name: Upload Debian .deb artifact
uses: softprops/action-gh-release@v1
with:
files: /home/runner/out/plrust*.deb
arm64_deb_artifacts:
name: Build aarch64 Debian artifacts
runs-on: [self-hosted, linux, ARM64, launch_template_id__lt-0bad2911d6aad1b0d]
strategy:
matrix:
pg_version: [pg13, pg14, pg15, pg16] # See MATRIX NOTES above
fail-fast: false
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Install Docker
run: |
sudo apt-get update
sudo apt-get install -y \
ca-certificates \
curl \
gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Set up docker to point to the EBS volume
sudo service docker stop
echo '{"data-root": "/workdir/.dockerdata"}' | sudo tee -a /etc/docker/daemon.json > /dev/null
sudo service docker start
- name: Build and extract Debian .deb artifact via Docker
run: |
echo "-- Setting variables --"
export PG_VER=$(echo ${{ matrix.pg_version}} | cut -c 3-)
export PLRUST_VER=$( echo "${{ github.ref_name }}" | sed -e s/^v// )
echo "-- Building artifact via Docker --"
sudo docker build \
--build-arg PG_VER=$PG_VER \
--build-arg PLRUST_VER=$PLRUST_VER \
-f .github/docker/Dockerfile.debian-artifact-build \
-t plrust-artifact-debian \
.
echo "-- Creating container --"
container_id=$(sudo docker create plrust-artifact-debian)
echo "-- Extracting file from container --"
sudo docker cp $container_id:/out /home/ubuntu
echo "-- Destroying container --"
sudo docker rm -v $container_id
- name: Upload Debian .deb artifact
uses: softprops/action-gh-release@v1
with:
files: /home/ubuntu/out/*.deb