-
Notifications
You must be signed in to change notification settings - Fork 78
59 lines (52 loc) · 2.35 KB
/
build-package-prod.yaml
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
# This rebuilds a single package from the latest tag and uploads to the prod folder (dist/).
# The cron-rebuild-packages-prod workflow triggers this once for each package.
name: build-package-prod
on:
repository_dispatch:
types: [build-package-prod]
workflow_dispatch:
inputs:
package:
description: package to build
required: true
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.21'
- uses: actions/checkout@v4
- env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PROD_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PROD_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: "us-east-1"
PKG: ${{ github.event.client_payload.package || github.event.inputs.package }}
run: |
git fetch --tags
tag=$(git tag | grep '^v20' | grep -v 'v2022\.09\.04' | sort | tail -1)
git checkout $tag
export VERSION_TAG=$tag # requited if this is the common package
export KURL_UTIL_IMAGE=replicated/kurl-util:$tag # required if this is the common package
make dist/$PKG
MD5="$(openssl md5 -binary dist/$PKG | base64)"
GITSHA="$(git rev-parse HEAD)"
aws s3 cp dist/$PKG s3://kurl-sh/dist/${tag}/$PKG \
--metadata-directive REPLACE --metadata md5="${MD5}",gitsha="${GITSHA}"
aws s3 cp s3://kurl-sh/dist/${tag}/$PKG s3://kurl-sh/dist/$PKG \
--metadata-directive REPLACE --metadata md5="${MD5}",gitsha="${GITSHA}"
- name: purge package cache
env:
PKG: ${{ github.event.client_payload.package || github.event.inputs.package }}
CF_EMAIL: ${{ secrets.CF_EMAIL }}
CF_API_KEY: ${{ secrets.CF_API_KEY }}
CF_KURL_ZONE: ${{ secrets.CF_KURL_ZONE }}
run: |
git fetch --tags
tag=$(git tag | grep '^v20' | grep -v 'v2022\.09\.04' | sort | tail -1)
echo "purging s3.kurl.sh/dist/${tag}/$PKG and s3.kurl.sh/dist/$PKG"
curl -X POST "https://api.cloudflare.com/client/v4/zones/$CF_KURL_ZONE/purge_cache" \
-H "X-Auth-Email: $CF_EMAIL" \
-H "Authorization: Bearer $CF_API_KEY" \
-H "Content-Type: application/json" \
--data '{"prefixes":["s3.kurl.sh/dist/${tag}/$PKG", "s3.kurl.sh/dist/$PKG"]}'