Skip to content

Commit b9ac815

Browse files
committed
Use Cloudflare and rclone for release artifacts
1 parent e00b69b commit b9ac815

File tree

5 files changed

+33
-27
lines changed

5 files changed

+33
-27
lines changed

.github/workflows/release.yml

+15-11
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,25 @@ jobs:
2121

2222
source:
2323
runs-on: ubuntu-latest
24+
container:
25+
image: ghcr.io/inko-lang/ci:fedora
2426
needs:
2527
- lints
2628
- linux
2729
- mac
2830
- freebsd
2931
env:
30-
AWS_REGION: eu-west-1
31-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
32-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
32+
RCLONE_S3_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_ACCESS_KEY_ID }}
33+
RCLONE_S3_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_SECRET_ACCESS_KEY }}
34+
RCLONE_S3_ENDPOINT: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
3335
steps:
3436
- uses: actions/checkout@v4
35-
- run: make release/source
36-
- run: make release/manifest
37+
with:
38+
fetch-depth: 0
39+
- name: Upload source archive
40+
run: make release/source
41+
- name: Update manifest
42+
run: make release/manifest
3743

3844
container:
3945
runs-on: ubuntu-latest
@@ -76,16 +82,14 @@ jobs:
7682
- mac
7783
- freebsd
7884
env:
79-
AWS_REGION: eu-west-1
80-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
81-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
85+
RCLONE_S3_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_ACCESS_KEY_ID }}
86+
RCLONE_S3_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_SECRET_ACCESS_KEY }}
87+
RCLONE_S3_ENDPOINT: https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com
8288
steps:
83-
- name: Install dependencies
84-
run: microdnf install --quiet --assumeyes awscli2 git tar make
8589
- uses: actions/checkout@v4
8690
with:
8791
fetch-depth: 0
88-
- name: Generating runtimes
92+
- name: Upload runtimes
8993
run: make runtimes
9094

9195
docs:

Makefile

+11-10
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ TMP_DIR := tmp
5959
SOURCE_TAR := ${TMP_DIR}/${VERSION}.tar.gz
6060

6161
# The path to the versions file.
62-
MANIFEST := ${TMP_DIR}/manifest.txt
62+
MANIFEST_NAME := manifest.txt
63+
MANIFEST := ${TMP_DIR}/${MANIFEST_NAME}
6364

6465
build:
6566
INKO_STD=${RUNTIME_STD} INKO_RT=${RUNTIME_RT} cargo build --release
@@ -84,16 +85,16 @@ ${SOURCE_TAR}: ${TMP_DIR}
8485
| gzip > "${@}"
8586

8687
release/source: ${SOURCE_TAR}
87-
aws s3 cp --acl public-read "${SOURCE_TAR}" s3://${RELEASES_BUCKET}/
88+
rclone copy --config rclone.conf --checksum --verbose \
89+
"${SOURCE_TAR}" "production:${RELEASES_BUCKET}"
8890

8991
release/manifest: ${TMP_DIR}
90-
aws s3 ls s3://${RELEASES_BUCKET}/ | \
91-
grep -oP '(\d+\.\d+\.\d+\.tar.gz)$$' | \
92-
grep -oP '(\d+\.\d+\.\d+)' | \
93-
sort > "${MANIFEST}"
94-
aws s3 cp --acl public-read "${MANIFEST}" s3://${RELEASES_BUCKET}/
95-
aws cloudfront create-invalidation \
96-
--distribution-id ${RELEASES_CLOUDFRONT_ID} --paths "/*"
92+
rclone copyto --config rclone.conf \
93+
"production:${RELEASES_BUCKET}/${MANIFEST_NAME}" "${MANIFEST}"
94+
echo "${VERSION}" >> "${MANIFEST}"
95+
sort --version-sort "${MANIFEST}"
96+
rclone copy --config rclone.conf --checksum --verbose \
97+
"${MANIFEST}" "production:${RELEASES_BUCKET}"
9798

9899
release/changelog:
99100
clogs "${VERSION}"
@@ -151,7 +152,7 @@ docs/watch:
151152
cd docs && bash scripts/watch.sh
152153

153154
docs/publish: docs/setup docs/build
154-
cd docs && rclone sync --config rclone.conf --checksum --verbose \
155+
cd docs && rclone sync --config ../rclone.conf --checksum --verbose \
155156
public "production:${DOCS_BUCKET}/manual/${DOCS_FOLDER}"
156157

157158
runtimes:

ci/docker/fedora/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ENV PATH /opt/cargo/bin:$PATH
88
ENV CARGO_HOME /opt/cargo
99
ENV RUSTUP_HOME /opt/rustup
1010

11-
RUN sudo dnf install --assumeyes --quiet gcc make tar git rustup \
11+
RUN sudo dnf install --assumeyes --quiet gcc make tar git rustup rclone \
1212
llvm$LLVM_VERSION llvm$LLVM_VERSION-devel \
1313
llvm$LLVM_VERSION-static libstdc++-devel libstdc++-static \
1414
libffi-devel zlib-devel

docs/rclone.conf rclone.conf

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ type = s3
33
provider = Cloudflare
44
env_auth = true
55
region = auto
6+
no_check_bucket = true

scripts/runtimes.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ VERSION="${1}"
1717
# The directory to place the runtimes in.
1818
DIR="tmp/runtimes/${VERSION}"
1919

20-
# The S3 bucket to store the runtime files in.
21-
S3_BUCKET="releases.inko-lang.org"
20+
# The Cloudflare bucket to store the runtime files in.
21+
BUCKET="inko-releases"
2222

2323
function rustup_lib {
2424
local home
@@ -80,6 +80,6 @@ build "aarch64-unknown-linux-musl" "arm64-linux-musl"
8080
build "x86_64-apple-darwin" "amd64-mac-native"
8181
build "aarch64-apple-darwin" "arm64-mac-native"
8282

83-
# Upload the results to the S3 bucket.
84-
aws s3 sync --no-progress --acl=public-read --cache-control max-age=86400 \
85-
"${DIR}" "s3://${S3_BUCKET}/runtimes/${VERSION}"
83+
# Upload the results to the bucket.
84+
rclone sync --config rclone.conf --checksum --verbose \
85+
"${DIR}" "production:${BUCKET}/runtimes/${VERSION}"

0 commit comments

Comments
 (0)