Skip to content

Bleeding Release

Bleeding Release #345

# moon: The build system and package manager for MoonBit.
# Copyright (C) 2024 International Digital Economy Academy
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# For inquiries, you can contact us via e-mail at [email protected].
name: Bleeding Release
# trigger by moonc-version-dont-delete/.github/workflows/ci.yml when moonc merged PR
on:
workflow_dispatch:
jobs:
build:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, macos-13, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
- name: Cargo cache
uses: actions/cache@v4
with:
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
path: ~/.cargo/registry
- name: Build
run: cargo build --release
- name: Bleeding Release 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: |
case $(uname -ms) in
'Darwin x86_64')
PLATFORM=darwin-x86_64
;;
'Darwin arm64')
PLATFORM=darwin-aarch64
;;
'Linux x86_64')
PLATFORM=linux-x86_64
;;
esac
echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV
rm -rf tmp-bins
mkdir tmp-bins
curl https://cli.moonbitlang.com/moon-ci/$(uname -s)-$(uname -m).tar.gz --output moonbit.tar.gz
curl https://cli.moonbitlang.com/moon-ci/$(uname -s)-$(uname -m)/mooncake --output mooncake
tar xf moonbit.tar.gz --directory ./tmp-bins/
cp -L ./target/release/moonrun ./tmp-bins/
cp -L ./target/release/moon ./tmp-bins/
cp -L ./mooncake ./tmp-bins/
ls ./tmp-bins/
pushd tmp-bins && shasum -a 256 -- * >../moonbit-$PLATFORM.sha256 && popd
tar czf ./moonbit-$PLATFORM.tar.gz --directory=./tmp-bins .
aws s3 cp ./moonbit-$PLATFORM.tar.gz s3://cli.moonbitlang.com/binaries/bleeding/moonbit-$PLATFORM.tar.gz
aws s3 cp ./moonbit-$PLATFORM.sha256 s3://cli.moonbitlang.com/binaries/bleeding/moonbit-$PLATFORM.sha256
aws cloudfront create-invalidation --distribution-id E1KQYZEVEB0TAY --paths "/*"
- name: Bleeding Release 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 }}
shell: pwsh
run: |
Remove-Item -Recurse -Force tmp-bins -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path tmp-bins
Invoke-WebRequest -Uri "https://cli.moonbitlang.com/moon-ci/Windows-x86_64.zip" -OutFile moonbit.zip
Invoke-WebRequest -Uri "https://cli.moonbitlang.com/moon-ci/Windows-x86_64/mooncake.exe" -OutFile mooncake.exe
Expand-Archive -Path moonbit.zip -DestinationPath .\tmp-bins
Copy-Item .\target\release\moonrun.exe .\tmp-bins
Copy-Item .\target\release\moon.exe .\tmp-bins
Copy-Item .\mooncake.exe .\tmp-bins
Get-ChildItem .\tmp-bins
Push-Location tmp-bins
Get-FileHash -Algorithm SHA256 * | ForEach-Object { $_.Hash + " " + $_.Path.Split("\")[-1] } | Out-File -FilePath ..\moonbit-windows-x86_64.sha256 -Encoding utf8
Pop-Location
Compress-Archive -Path .\tmp-bins\* -DestinationPath .\moonbit-windows-x86_64.zip
aws s3 cp .\moonbit-windows-x86_64.zip s3://cli.moonbitlang.com/binaries/bleeding/moonbit-windows-x86_64.zip
aws s3 cp .\moonbit-windows-x86_64.sha256 s3://cli.moonbitlang.com/binaries/bleeding/moonbit-windows-x86_64.sha256
aws cloudfront create-invalidation --distribution-id E1KQYZEVEB0TAY --paths "/*"