-
Notifications
You must be signed in to change notification settings - Fork 6
177 lines (149 loc) · 6.04 KB
/
create-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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Create Release
# Make new images for every published release
on:
release:
types: [published]
workflow_dispatch:
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1'
jobs:
package:
name: Package builder app
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Get release tag
uses: ./.github/actions/release-tag
id: tag
# re-enable this when requirements.txt has actual dependencies
# - name: Bundle dependencies
# run: |
# python3 -m pip install -r requirements.txt --target builder
# rm -rf builder/*.dist-info
- name: Package builder to S3
run: |
mkdir -p build
mkdir -p staging
cp -r builder staging/.
python3 -m zipapp --python="/usr/bin/env python3" -m "builder.main:main" --output=build/builder staging
aws s3 cp build/builder s3://$AWS_S3_BUCKET/releases/${{ steps.tag.outputs.release_tag }}/builder.pyz
- name: Artifact builder
uses: actions/upload-artifact@v3
with:
name: builder
path: build/builder
export-linux-images:
name: Release aws-crt-${{ matrix.variant }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
variant:
- manylinux1-x86
- manylinux1-x64
- manylinux2014-x86
- manylinux2014-x64
- manylinux2014-aarch64
- musllinux-1-1-aarch64
- musllinux-1-1-x64
- al2012-x64
- al2-x64
- ubuntu-18-x64
- ubuntu-20-x64
- ubuntu-20-aarch64
- node-10-linux-x64
- swift-5-al2-x64
- swift-5-centos-x64
- swift-5-ubuntu-x64
- rhel8-x64
- opensuse-leap
- fedora-34-x64
- alpine-3.16-x64
- alpine-3.16-x86
- alpine-3.16-arm64
- alpine-3.16-armv7
- alpine-3.16-armv6
- openwrt-x64-openjdk8
steps:
- name: Checkout Sources
uses: actions/checkout@v4
- name: Get release tag
uses: ./.github/actions/release-tag
id: tag
- name: Install entrypoint
run: cat .github/docker-images/entrypoint.sh | sed s/version=LATEST/version=${{ steps.tag.outputs.release_tag }}/ > .github/docker-images/${{ matrix.variant }}/entrypoint.sh
- name: Install qemu/docker
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Build aws-crt-${{ matrix.variant }} image
uses: whoan/docker-build-with-cache-action@v5
with:
registry: ${{ secrets.AWS_ECR_REPO }}
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
image_name: aws-crt-${{ matrix.variant }}
image_tag: ${{ steps.tag.outputs.release_tag }}
context: .github/docker-images/${{ matrix.variant }}
build_extra_args: --compress=true
- name: Login to docker repos
run: |
aws ecr get-login-password --region us-east-1 | docker login ${{ secrets.AWS_ECR_REPO }} -u AWS --password-stdin
- name: Create ECR repo if necessary
run: |
if ! aws --region us-east-1 ecr describe-repositories --repository-names aws-crt-${{ matrix.variant }} > /dev/null 2>&1; then \
aws --region us-east-1 ecr create-repository --repository-name aws-crt-${{ matrix.variant }}; \
fi
- name: Tag/push release images as latest
run: |
export IMAGE_TAG=${{ steps.tag.outputs.release_tag }}
docker tag ${{ secrets.AWS_ECR_REPO }}/aws-crt-${{ matrix.variant }}:$IMAGE_TAG ${{ secrets.AWS_ECR_REPO }}/aws-crt-${{ matrix.variant }}:latest
docker push ${{ secrets.AWS_ECR_REPO }}/aws-crt-${{ matrix.variant }}:$IMAGE_TAG
docker push ${{ secrets.AWS_ECR_REPO }}/aws-crt-${{ matrix.variant }}:latest
- name: Export aws-crt-${{ matrix.variant }} image to S3/releases
run: |
export IMAGE_TAG=${{ steps.tag.outputs.release_tag }}
docker save ${{ secrets.AWS_ECR_REPO }}/aws-crt-${{ matrix.variant }}:$IMAGE_TAG \
| gzip \
| aws s3 cp - s3://${{env.AWS_S3_BUCKET}}/releases/$IMAGE_TAG/aws-crt-${{ matrix.variant }}.tar.gz
aws s3 cp s3://${{env.AWS_S3_BUCKET}}/releases/$IMAGE_TAG/aws-crt-${{ matrix.variant }}.tar.gz s3://${{env.AWS_S3_BUCKET}}/LATEST/aws-crt-${{ matrix.variant }}.tar.gz
# The job will directly pull the image from the latest, and push to the new tag.
# This job is only for a temporary fix. The image would not get updated.
passthrough-images:
name: ${{ matrix.variant }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
variant:
- raspbian-bullseye
steps:
- name: Checkout Sources
uses: actions/checkout@v4
- name: Get release tag
uses: ./.github/actions/release-tag
id: tag
- name: Login to docker repo
run: aws ecr get-login-password --region us-east-1 | docker login ${{ secrets.AWS_ECR_REPO }} -u AWS --password-stdin
- name: Pull latest image and push
run: |
if ! aws --region us-east-1 ecr describe-repositories --repository-names aws-crt-${{ matrix.variant }} > /dev/null 2>&1; then \
exit 1
fi
export IMAGE_TAG=${{ steps.tag.outputs.release_tag }}
docker pull ${{ secrets.AWS_ECR_REPO }}/aws-crt-${{ matrix.variant }}:latest
docker tag ${{ secrets.AWS_ECR_REPO }}/aws-crt-${{ matrix.variant }}:latest ${{ secrets.AWS_ECR_REPO }}/aws-crt-${{ matrix.variant }}:$IMAGE_TAG
docker push ${{ secrets.AWS_ECR_REPO }}/aws-crt-${{ matrix.variant }}:$IMAGE_TAG
upload-ci-script:
name: Upload container ci script
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Get release tag
uses: ./.github/actions/release-tag
id: tag
- name: Upload script
run: aws s3 cp ./.github/workflows/linux-container-ci.sh s3://aws-crt-test-stuff/ci/${{ steps.tag.outputs.release_tag }}/linux-container-ci.sh