File tree Expand file tree Collapse file tree 2 files changed +39
-9
lines changed
Expand file tree Collapse file tree 2 files changed +39
-9
lines changed Original file line number Diff line number Diff line change 22# TODO: rename to scripts/release_rebar.sh. publish_rebar.sh is a temporary name for prettier git diff.
33
44# Usage:
5- # ELIXIR_PEM=/path/to/elixir.pem \
6- # release_rebar.sh HEX_VERSION
5+ #
6+ # $ ELIXIR_PEM=/path/to/elixir.pem \
7+ # HEX_FASTLY_KEY=... \
8+ # HEX_FASTLY_BUILDS_SERVICE_ID=... \
9+ # release_rebar.sh
710#
811# Unless ELIXIR_PEM is set, nothing is uploaded. After running, can be locally tested:
912#
@@ -37,9 +40,9 @@ function main {
3740 path=" ${path# ./ } "
3841 echo " uploading ${path} ..."
3942 s3up " ${path} " " ${path} "
40-
41- # TODO purge fastly
4243 done
44+
45+ purge_key " ${HEX_FASTLY_BUILDS_SERVICE_ID} " " installs"
4346 else
4447 echo " ELIXIR_PEM is empty, skipping"
4548 exit 1
@@ -86,4 +89,16 @@ function s3down {
8689 aws s3 cp " s3://s3.hex.pm/installs/${1} " " ${2} "
8790}
8891
92+ # $1 = service
93+ # $2 = key
94+ function purge_key() {
95+ curl \
96+ --fail \
97+ -X POST \
98+ -H " Fastly-Key: ${HEX_FASTLY_KEY} " \
99+ -H " Accept: application/json" \
100+ -H " Content-Length: 0" \
101+ " https://api.fastly.com/service/$1 /purge/$2 "
102+ }
103+
89104main $*
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
33# Usage:
4- # ELIXIR_PEM=/path/to/elixir.pem \
5- # release_hex.sh HEX_VERSION
4+ #
5+ # $ ELIXIR_PEM=/path/to/elixir.pem \
6+ # HEX_FASTLY_KEY=... \
7+ # HEX_FASTLY_BUILDS_SERVICE_ID=... \
8+ # release_hex.sh HEX_VERSION
69#
710# Unless ELIXIR_PEM is set, nothing is uploaded. After running, can be locally tested:
811#
@@ -19,7 +22,7 @@ function main {
1922 rm -rf " ${installs_dir} "
2023 mkdir " ${installs_dir} "
2124
22- s3down hex.csv hex.csv
25+ s3down hex.csv " ${hex_csv} "
2326 touch " ${hex_csv} "
2427 sed -i.bak " /^${hex_version} ,/d" " ${hex_csv} "
2528
@@ -43,9 +46,9 @@ function main {
4346 path=" ${path# ./ } "
4447 echo " uploading ${path} ..."
4548 s3up " ${path} " " ${path} "
46-
47- # TODO purge fastly
4849 done
50+
51+ purge_key " ${HEX_FASTLY_BUILDS_SERVICE_ID} " " installs"
4952 else
5053 echo " ELIXIR_PEM is empty, skipping"
5154 exit 1
@@ -92,4 +95,16 @@ function s3down {
9295 aws s3 cp " s3://s3.hex.pm/installs/${1} " " ${2} "
9396}
9497
98+ # $1 = service
99+ # $2 = key
100+ function purge_key() {
101+ curl \
102+ --fail \
103+ -X POST \
104+ -H " Fastly-Key: ${HEX_FASTLY_KEY} " \
105+ -H " Accept: application/json" \
106+ -H " Content-Length: 0" \
107+ " https://api.fastly.com/service/$1 /purge/$2 "
108+ }
109+
95110main $*
You can’t perform that action at this time.
0 commit comments