Skip to content

Commit 048effe

Browse files
committed
upload binaries to R2 as well
We will sunset the S3 bucket soon. The .nupkg web redirection is not needed since it's handled by build.haxe.org HaxeFoundation/build.haxe.org@b127d70
1 parent 65c51d9 commit 048effe

1 file changed

Lines changed: 57 additions & 30 deletions

File tree

.github/workflows/main.yml

Lines changed: 57 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ jobs:
578578
deploy:
579579
if: success() && github.repository_owner == 'HaxeFoundation' && github.event_name != 'pull_request'
580580
needs: [linux-test, mac-test, windows64-test]
581-
runs-on: ubuntu-22.04
581+
runs-on: ubuntu-24.04
582582
steps:
583583
# this is only needed for to get `COMMIT_DATE`...
584584
# maybe https://github.community/t/expose-commit-timestamp-in-the-github-context-data/16460/3
@@ -589,11 +589,12 @@ jobs:
589589
- name: Download build artifacts
590590
uses: actions/download-artifact@v4
591591

592-
- name: Install awscli
592+
- name: Install rclone
593593
run: |
594594
set -ex
595595
sudo apt-get update -qqy
596-
sudo apt-get install -qqy awscli
596+
sudo apt-get install -qqy rclone
597+
rclone config touch
597598
598599
# https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions
599600
- name: Extract branch name
@@ -604,46 +605,72 @@ jobs:
604605
- name: Upload binaries
605606
shell: bash
606607
env:
607-
AWS_ACCESS_KEY_ID: ${{ secrets.HXBUILDS_AWS_ACCESS_KEY_ID }}
608-
AWS_SECRET_ACCESS_KEY: ${{ secrets.HXBUILDS_AWS_SECRET_ACCESS_KEY }}
609-
HXBUILDS_S3ADDR: ${{ secrets.HXBUILDS_S3ADDR }}
610-
AWS_EC2_METADATA_DISABLED: true
608+
RCLONE_CONFIG_S3_TYPE: "s3"
609+
RCLONE_CONFIG_S3_PROVIDER: "AWS"
610+
RCLONE_CONFIG_S3_ACCESS_KEY_ID: ${{ secrets.HXBUILDS_AWS_ACCESS_KEY_ID }}
611+
RCLONE_CONFIG_S3_SECRET_ACCESS_KEY: ${{ secrets.HXBUILDS_AWS_SECRET_ACCESS_KEY }}
612+
RCLONE_CONFIG_R2_TYPE: "s3"
613+
RCLONE_CONFIG_R2_PROVIDER: "Cloudflare"
614+
RCLONE_CONFIG_R2_ACCESS_KEY_ID: ${{ vars.R2_ACCESS_KEY_ID }}
615+
RCLONE_CONFIG_R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
616+
RCLONE_CONFIG_R2_ENDPOINT: ${{ vars.R2_ENDPOINT }}
617+
RCLONE_CONFIG_R2_NO_CHECK_BUCKET: "true"
618+
RCLONE_CONFIG_R2_ACL: "private"
611619
run: |
612620
set -ex
613621
COMMIT_HASH_SHORT=${GITHUB_SHA:0:7}
614622
COMMIT_DATE=`TZ=UTC git show --quiet --date='format-local:%Y-%m-%d' --format="%cd"`
615623
FILE_NAME=haxe_${COMMIT_DATE}_${{ steps.extract_branch.outputs.branch }}_${COMMIT_HASH_SHORT}
616-
aws s3 cp linuxBinaries/*_bin.tar.gz ${HXBUILDS_S3ADDR}/haxe/linux64/${FILE_NAME}.tar.gz
617-
aws s3 cp linuxArm64Binaries/*_bin.tar.gz ${HXBUILDS_S3ADDR}/haxe/linux-arm64/${FILE_NAME}.tar.gz
618-
aws s3 cp macBinaries/*_bin.tar.gz ${HXBUILDS_S3ADDR}/haxe/mac/${FILE_NAME}.tar.gz
619-
aws s3 cp macBinaries/*_installer.tar.gz ${HXBUILDS_S3ADDR}/haxe/mac-installer/${FILE_NAME}.tar.gz
620-
aws s3 cp win64Binaries/*_bin.zip ${HXBUILDS_S3ADDR}/haxe/windows64/${FILE_NAME}.zip
621-
aws s3 cp win64Binaries/*_installer.zip ${HXBUILDS_S3ADDR}/haxe/windows64-installer/${FILE_NAME}.zip
622-
aws s3 cp win64Binaries/*.nupkg ${HXBUILDS_S3ADDR}/haxe/windows64-choco/
624+
625+
rclone copyto linuxBinaries/*_bin.tar.gz r2:hxbuilds-hjtpx7fj/builds/haxe/linux64/${FILE_NAME}.tar.gz
626+
rclone copyto linuxArm64Binaries/*_bin.tar.gz r2:hxbuilds-hjtpx7fj/builds/haxe/linux-arm64/${FILE_NAME}.tar.gz
627+
rclone copyto macBinaries/*_bin.tar.gz r2:hxbuilds-hjtpx7fj/builds/haxe/mac/${FILE_NAME}.tar.gz
628+
rclone copyto macBinaries/*_installer.tar.gz r2:hxbuilds-hjtpx7fj/builds/haxe/mac-installer/${FILE_NAME}.tar.gz
629+
rclone copyto win64Binaries/*_bin.zip r2:hxbuilds-hjtpx7fj/builds/haxe/windows64/${FILE_NAME}.zip
630+
rclone copyto win64Binaries/*_installer.zip r2:hxbuilds-hjtpx7fj/builds/haxe/windows64-installer/${FILE_NAME}.zip
631+
rclone copy win64Binaries/*.nupkg r2:hxbuilds-hjtpx7fj/builds/haxe/windows64-choco/
632+
633+
rclone copyto linuxBinaries/*_bin.tar.gz s3:hxbuilds/builds/haxe/linux64/${FILE_NAME}.tar.gz
634+
rclone copyto linuxArm64Binaries/*_bin.tar.gz s3:hxbuilds/builds/haxe/linux-arm64/${FILE_NAME}.tar.gz
635+
rclone copyto macBinaries/*_bin.tar.gz s3:hxbuilds/builds/haxe/mac/${FILE_NAME}.tar.gz
636+
rclone copyto macBinaries/*_installer.tar.gz s3:hxbuilds/builds/haxe/mac-installer/${FILE_NAME}.tar.gz
637+
rclone copyto win64Binaries/*_bin.zip s3:hxbuilds/builds/haxe/windows64/${FILE_NAME}.zip
638+
rclone copyto win64Binaries/*_installer.zip s3:hxbuilds/builds/haxe/windows64-installer/${FILE_NAME}.zip
639+
rclone copy win64Binaries/*.nupkg s3:hxbuilds/builds/haxe/windows64-choco/
623640
624641
- name: Update "latest"
625642
if: github.ref == 'refs/heads/development'
626643
shell: bash
627644
env:
628-
AWS_ACCESS_KEY_ID: ${{ secrets.HXBUILDS_AWS_ACCESS_KEY_ID }}
629-
AWS_SECRET_ACCESS_KEY: ${{ secrets.HXBUILDS_AWS_SECRET_ACCESS_KEY }}
630-
HXBUILDS_S3ADDR: ${{ secrets.HXBUILDS_S3ADDR }}
631-
AWS_EC2_METADATA_DISABLED: true
645+
RCLONE_CONFIG_S3_TYPE: "s3"
646+
RCLONE_CONFIG_S3_PROVIDER: "AWS"
647+
RCLONE_CONFIG_S3_ACCESS_KEY_ID: ${{ secrets.HXBUILDS_AWS_ACCESS_KEY_ID }}
648+
RCLONE_CONFIG_S3_SECRET_ACCESS_KEY: ${{ secrets.HXBUILDS_AWS_SECRET_ACCESS_KEY }}
649+
RCLONE_CONFIG_R2_TYPE: "s3"
650+
RCLONE_CONFIG_R2_PROVIDER: "Cloudflare"
651+
RCLONE_CONFIG_R2_ACCESS_KEY_ID: ${{ vars.R2_ACCESS_KEY_ID }}
652+
RCLONE_CONFIG_R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
653+
RCLONE_CONFIG_R2_ENDPOINT: ${{ vars.R2_ENDPOINT }}
654+
RCLONE_CONFIG_R2_NO_CHECK_BUCKET: "true"
655+
RCLONE_CONFIG_R2_ACL: "private"
632656
run: |
633657
set -ex
634-
aws s3 cp linuxBinaries/*_bin.tar.gz ${HXBUILDS_S3ADDR}/haxe/linux64/haxe_latest.tar.gz
635-
aws s3 cp linuxArm64Binaries/*_bin.tar.gz ${HXBUILDS_S3ADDR}/haxe/linux-arm64/haxe_latest.tar.gz
636-
aws s3 cp macBinaries/*_bin.tar.gz ${HXBUILDS_S3ADDR}/haxe/mac/haxe_latest.tar.gz
637-
aws s3 cp macBinaries/*_installer.tar.gz ${HXBUILDS_S3ADDR}/haxe/mac-installer/haxe_latest.tar.gz
638-
aws s3 cp win64Binaries/*_bin.zip ${HXBUILDS_S3ADDR}/haxe/windows64/haxe_latest.zip
639-
aws s3 cp win64Binaries/*_installer.zip ${HXBUILDS_S3ADDR}/haxe/windows64-installer/haxe_latest.zip
640-
641-
# Chocolatey packages have to be named with version number,
642-
# so let's use web redirection to keep the original file name.
643-
[[ "$HXBUILDS_S3ADDR" =~ s3://([^/]+)(.*) ]] && HXBUILDS_S3BUCKET="${BASH_REMATCH[1]}" && HXBUILDS_S3PATH="${BASH_REMATCH[2]}"
644-
[[ `echo win64Binaries/*.nupkg` =~ win64Binaries/(.+) ]] && FILE_NAME="${BASH_REMATCH[1]}"
645-
aws s3 cp ${HXBUILDS_S3ADDR}/haxe/windows64-choco/${FILE_NAME} ${HXBUILDS_S3ADDR}/haxe/windows64-choco/haxe_latest.nupkg --acl public-read --website-redirect "${HXBUILDS_S3PATH}/haxe/windows64-choco/${FILE_NAME}"
646658
659+
rclone copyto linuxBinaries/*_bin.tar.gz r2:hxbuilds-hjtpx7fj/builds/haxe/linux64/haxe_latest.tar.gz
660+
rclone copyto linuxArm64Binaries/*_bin.tar.gz r2:hxbuilds-hjtpx7fj/builds/haxe/linux-arm64/haxe_latest.tar.gz
661+
rclone copyto macBinaries/*_bin.tar.gz r2:hxbuilds-hjtpx7fj/builds/haxe/mac/haxe_latest.tar.gz
662+
rclone copyto macBinaries/*_installer.tar.gz r2:hxbuilds-hjtpx7fj/builds/haxe/mac-installer/haxe_latest.tar.gz
663+
rclone copyto win64Binaries/*_bin.zip r2:hxbuilds-hjtpx7fj/builds/haxe/windows64/haxe_latest.zip
664+
rclone copyto win64Binaries/*_installer.zip r2:hxbuilds-hjtpx7fj/builds/haxe/windows64-installer/haxe_latest.zip
665+
rclone copyto win64Binaries/*.nupkg r2:hxbuilds-hjtpx7fj/builds/haxe/windows64-choco/haxe_latest.nupkg
666+
667+
rclone copyto linuxBinaries/*_bin.tar.gz s3:hxbuilds/builds/haxe/linux64/haxe_latest.tar.gz
668+
rclone copyto linuxArm64Binaries/*_bin.tar.gz s3:hxbuilds/builds/haxe/linux-arm64/haxe_latest.tar.gz
669+
rclone copyto macBinaries/*_bin.tar.gz s3:hxbuilds/builds/haxe/mac/haxe_latest.tar.gz
670+
rclone copyto macBinaries/*_installer.tar.gz s3:hxbuilds/builds/haxe/mac-installer/haxe_latest.tar.gz
671+
rclone copyto win64Binaries/*_bin.zip s3:hxbuilds/builds/haxe/windows64/haxe_latest.zip
672+
rclone copyto win64Binaries/*_installer.zip s3:hxbuilds/builds/haxe/windows64-installer/haxe_latest.zip
673+
rclone copyto win64Binaries/*.nupkg s3:hxbuilds/builds/haxe/windows64-choco/haxe_latest.nupkg
647674
648675
deploy_apidoc:
649676
if: success() && github.repository_owner == 'HaxeFoundation' && github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/development')

0 commit comments

Comments
 (0)