Skip to content

Commit

Permalink
Merge pull request #270 from moonbitlang/zhiyuan/fix-cd
Browse files Browse the repository at this point in the history
create cd using aws
  • Loading branch information
bzy-debug authored Sep 9, 2024
2 parents 9604e5b + 51602f2 commit 42a657d
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,29 @@ jobs:
- name: Build
run: cargo build --release

- name: Setup Rclone
uses: AnimMouse/setup-rclone@v1
with:
rclone_config: ${{ secrets.RCLONE_CONFIG }}

- name: Upload(Unix)
if: ${{ matrix.os != 'windows-latest' }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
run: |
version=$(echo "$GITHUB_SHA" | cut -c 1-9)
rclone copy target/release/moon "aws:${{ secrets.AWS_BUCKET_NAME }}/bleeding-moon/$version/$(uname -s)-$(uname -m)/"
rclone copy target/release/moonrun "aws:${{ secrets.AWS_BUCKET_NAME }}/bleeding-moonrun/$version/$(uname -s)-$(uname -m)/"
rclone copy target/release/moonrun "aws:cli.moonbitlang.com/moon-ci/$(uname -s)-$(uname -m)/"
aws s3 cp target/release/moon "s3://${{ secrets.AWS_BUCKET_NAME }}/bleeding-moon/$version/$(uname -s)-$(uname -m)/"
aws s3 cp target/release/moonrun "s3://${{ secrets.AWS_BUCKET_NAME }}/bleeding-moonrun/$version/$(uname -s)-$(uname -m)/"
aws s3 cp target/release/moonrun "s3://cli.moonbitlang.com/moon-ci/$(uname -s)-$(uname -m)/"
- name: Upload(Windows)
if: ${{ matrix.os == 'windows-latest' }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
run: |
$version = "$env:GITHUB_SHA".Substring(0, 9)
rclone copyto -L .\target\release\moon.exe "aws:${{ secrets.AWS_BUCKET_NAME }}/bleeding-moon/$version/Windows-x86_64/moon.exe"
rclone copyto -L .\target\release\moonrun.exe "aws:${{ secrets.AWS_BUCKET_NAME }}/bleeding-moonrun/$version/Windows-x86_64/moonrun.exe"
rclone copyto -L .\target\release\moonrun.exe "aws:cli.moonbitlang.com/moon-ci/Windows-x86_64/moonrun.exe"
aws s3 cp .\target\release\moon.exe "s3://${{ secrets.AWS_BUCKET_NAME }}/bleeding-moon/$version/$(uname -s)-$(uname -m)/"
aws s3 cp .\target\release\moonrun.exe "s3://${{ secrets.AWS_BUCKET_NAME }}/bleeding-moonrun/$version/$(uname -s)-$(uname -m)/"
aws s3 cp .\target\release\moonrun.exe "s3://cli.moonbitlang.com/moon-ci/$(uname -s)-$(uname -m)/"
- name: Bleeding Release (macos-latest)
if: ${{ matrix.os == 'macos-latest' }}
Expand Down Expand Up @@ -117,18 +120,19 @@ jobs:
- name: Build
run: cargo build --release

- name: Setup Rclone
env:
RCLONE_CONFIG_PLAIN: ${{ secrets.RCLONE_CONFIG_PLAIN }}
- name: Setup AWS
run: |
curl https://rclone.org/install.sh | bash
mkdir -p ~/.config/rclone
echo "$RCLONE_CONFIG_PLAIN" > ~/.config/rclone/rclone.conf
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
- name: Upload
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
run: |
version="$(echo "$GITHUB_SHA" | cut -c 1-9)"
echo "$version"
rclone copy target/release/moon "aws:${{ secrets.AWS_BUCKET_NAME }}/bleeding-moon/$version/$(uname -s)-$(uname -m)/"
rclone copy target/release/moonrun "aws:${{ secrets.AWS_BUCKET_NAME }}/bleeding-moonrun/$version/$(uname -s)-$(uname -m)/"
rclone copy target/release/moonrun "aws:cli.moonbitlang.com/moon-ci/$(uname -s)-$(uname -m)/"
version=$(echo "$GITHUB_SHA" | cut -c 1-9)
aws s3 cp target/release/moon "s3://${{ secrets.AWS_BUCKET_NAME }}/bleeding-moon/$version/$(uname -s)-$(uname -m)/"
aws s3 cp target/release/moonrun "s3://${{ secrets.AWS_BUCKET_NAME }}/bleeding-moonrun/$version/$(uname -s)-$(uname -m)/"
aws s3 cp target/release/moonrun "s3://cli.moonbitlang.com/moon-ci/$(uname -s)-$(uname -m)/"

0 comments on commit 42a657d

Please sign in to comment.