Clarify map key ordering functionality in docs (#13764) #1531
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
name: builds.hex.pm | |
on: | |
push: | |
branches: | |
- main | |
- v*.* | |
tags: | |
- v* | |
env: | |
ELIXIR_OPTS: "--warnings-as-errors" | |
ERLC_OPTS: "warnings_as_errors" | |
LANG: C.UTF-8 | |
concurrency: builds_txt | |
jobs: | |
release_pre_built: | |
permissions: | |
id-token: write | |
attestations: write | |
strategy: | |
fail-fast: true | |
max-parallel: 1 | |
matrix: | |
include: | |
- otp: 25 | |
otp_version: "25.3" | |
upload_generic_version: upload_generic_version | |
- otp: 26 | |
otp_version: "26.0" | |
- otp: 27 | |
otp_version: "27.0" | |
build_docs: build_docs | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 50 | |
- name: Get tags | |
run: git fetch --tags origin | |
- uses: ./.github/workflows/release_pre_built | |
with: | |
otp_version: ${{ matrix.otp_version }} | |
otp: ${{ matrix.otp }} | |
build_docs: ${{ matrix.build_docs }} | |
- uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: 'elixir-otp-${{ matrix.otp }}.*' | |
- uses: actions/attest-build-provenance@v1 | |
if: ${{ matrix.build_docs }} | |
with: | |
subject-path: 'Docs.*' | |
- name: Utils.sh | |
run: | | |
cat << 'EOF' > utils.sh | |
function purge_key() { | |
curl \ | |
-X POST \ | |
-H "Fastly-Key: ${FASTLY_KEY}" \ | |
-H "Accept: application/json" \ | |
-H "Content-Length: 0" \ | |
"https://api.fastly.com/service/$1/purge/$2" | |
} | |
function purge() { | |
purge_key ${FASTLY_REPO_SERVICE_ID} $1 | |
purge_key ${FASTLY_BUILDS_SERVICE_ID} $1 | |
sleep 2 | |
purge_key ${FASTLY_REPO_SERVICE_ID} $1 | |
purge_key ${FASTLY_BUILDS_SERVICE_ID} $1 | |
sleep 2 | |
purge_key ${FASTLY_REPO_SERVICE_ID} $1 | |
purge_key ${FASTLY_BUILDS_SERVICE_ID} $1 | |
} | |
EOF | |
chmod +x utils.sh | |
- name: Upload Docs to S3 | |
if: ${{ matrix.build_docs }} | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.HEX_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.HEX_AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.HEX_AWS_REGION }} | |
AWS_S3_BUCKET: ${{ secrets.HEX_AWS_S3_BUCKET }} | |
FASTLY_REPO_SERVICE_ID: ${{ secrets.HEX_FASTLY_REPO_SERVICE_ID }} | |
FASTLY_BUILDS_SERVICE_ID: ${{ secrets.HEX_FASTLY_BUILDS_SERVICE_ID }} | |
FASTLY_KEY: ${{ secrets.HEX_FASTLY_KEY }} | |
run: | | |
source utils.sh | |
version=$(echo ${{ github.ref_name }} | sed -e 's/^v//g') | |
for f in doc/*; do | |
if [ -d "$f" ]; then | |
app=`echo $f | sed s/"doc\/"//` | |
tarball="${app}-${version}.tar.gz" | |
surrogate_key="docs/${app}-${version}" | |
tar -czf "${tarball}" -C "doc/${app}" . | |
aws s3 cp "${tarball}" "s3://${{ env.AWS_S3_BUCKET }}/docs/${tarball}" \ | |
--cache-control "public,max-age=3600" \ | |
--metadata "{\"surrogate-key\":\"${surrogate_key}\",\"surrogate-control\":\"public,max-age=604800\"}" | |
purge "${surrogate_key}" | |
fi | |
done | |
- name: Upload Precompiled to S3 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.HEX_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.HEX_AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.HEX_AWS_REGION }} | |
AWS_S3_BUCKET: ${{ secrets.HEX_AWS_S3_BUCKET }} | |
FASTLY_REPO_SERVICE_ID: ${{ secrets.HEX_FASTLY_REPO_SERVICE_ID }} | |
FASTLY_BUILDS_SERVICE_ID: ${{ secrets.HEX_FASTLY_BUILDS_SERVICE_ID }} | |
FASTLY_KEY: ${{ secrets.HEX_FASTLY_KEY }} | |
run: | | |
source utils.sh | |
aws s3 cp elixir-otp-${{ matrix.otp }}.zip "s3://${{ env.AWS_S3_BUCKET }}/builds/elixir/${{github.ref_name}}-otp-${{matrix.otp}}.zip" --cache-control "public,max-age=3600" --metadata "{\"surrogate-key\":\"builds builds/elixir builds/elixir/${{github.ref_name}}-otp-${{matrix.otp}}\",\"surrogate-control\":\"public,max-age=604800\"}" | |
purge builds/elixir/${{github.ref_name}}-otp-${{matrix.otp}} | |
if [ "${{matrix.upload_generic_version}}" == "upload_generic_version" ]; then | |
aws s3 cp elixir-otp-${{ matrix.otp }}.zip "s3://${{ env.AWS_S3_BUCKET }}/builds/elixir/${{github.ref_name}}.zip" --cache-control "public,max-age=3600" --metadata "{\"surrogate-key\":\"builds builds/elixir builds/elixir/${{github.ref_name}}\",\"surrogate-control\":\"public,max-age=604800\"}" | |
purge builds/elixir/${{github.ref_name}} | |
fi | |
- name: Update builds txt | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.HEX_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.HEX_AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.HEX_AWS_REGION }} | |
AWS_S3_BUCKET: ${{ secrets.HEX_AWS_S3_BUCKET }} | |
FASTLY_REPO_SERVICE_ID: ${{ secrets.HEX_FASTLY_REPO_SERVICE_ID }} | |
FASTLY_BUILDS_SERVICE_ID: ${{ secrets.HEX_FASTLY_BUILDS_SERVICE_ID }} | |
FASTLY_KEY: ${{ secrets.HEX_FASTLY_KEY }} | |
run: | | |
source utils.sh | |
date=$(date -u '+%Y-%m-%dT%H:%M:%SZ') | |
build_sha256=$(sha256sum elixir-otp-${{ matrix.otp }}.zip | cut -d ' ' -f 1) | |
ref_name=${{ github.ref_name }} | |
aws s3 cp s3://${{ env.AWS_S3_BUCKET }}/builds/elixir/builds.txt builds.txt || true | |
touch builds.txt | |
sed -i "/^${ref_name}-otp-${{ matrix.otp }} /d" builds.txt | |
echo -e "${ref_name}-otp-${{ matrix.otp }} ${{ github.sha }} ${date} ${build_sha256} \n$(cat builds.txt)" > builds.txt | |
if [ "${{matrix.upload_generic_version}}" == "upload_generic_version" ]; then | |
sed -i "/^${ref_name} /d" builds.txt | |
echo -e "${ref_name} ${{ github.sha }} ${date} ${build_sha256} \n$(cat builds.txt)" > builds.txt | |
fi | |
sort -u -k1,1 -o builds.txt builds.txt | |
aws s3 cp builds.txt s3://${{ env.AWS_S3_BUCKET }}/builds/elixir/builds.txt --cache-control "public,max-age=3600" --metadata '{"surrogate-key":"builds builds/elixir builds/elixir/txt","surrogate-control":"public,max-age=604800"}' | |
purge builds/elixir/txt |