build-package-staging #8937
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This rebuilds a single package from main and uploads to the staging/ folder. | |
# The cron-rebuild-packages-staging workflow triggers this once for each package. | |
name: build-package-staging | |
on: | |
repository_dispatch: | |
types: [build-package-staging] | |
workflow_dispatch: | |
inputs: | |
package: | |
description: package to build | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- 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 -f | |
export VERSION_TAG=$(git tag | grep '^v20' | sort | tail -1)-$(git rev-parse --short HEAD) | |
export KURL_UTIL_IMAGE=replicated/kurl-util:${VERSION_TAG} | |
make dist/$PKG | |
MD5="$(openssl md5 -binary dist/$PKG | base64)" | |
GITSHA="$(git rev-parse HEAD)" | |
aws s3 cp dist/$PKG s3://kurl-sh/staging/${VERSION_TAG}/$PKG \ | |
--metadata-directive REPLACE --metadata md5="${MD5}",gitsha="${GITSHA}" | |
aws s3 cp s3://kurl-sh/staging/${VERSION_TAG}/$PKG s3://kurl-sh/staging/$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 -f | |
export VERSION_TAG=$(git tag | grep '^v20' | sort | tail -1)-$(git rev-parse --short HEAD) | |
echo "purging s3-staging.kurl.sh/staging/${VERSION_TAG}/$PKG and s3-staging.kurl.sh/staging/$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-staging.kurl.sh/staging/${VERSION_TAG}/$PKG", "s3-staging.kurl.sh/staging/$PKG"]}' |