diff --git a/.github/workflows/build-deb-pkg.sh b/.github/workflows/build-deb-pkg.sh new file mode 100755 index 000000000000..169bc7b553e1 --- /dev/null +++ b/.github/workflows/build-deb-pkg.sh @@ -0,0 +1,32 @@ +PKG_ROOT=/tmp/avalanchego +DEBIAN_BASE_DIR=$PKG_ROOT/debian +AVALANCHE_BUILD_BIN_DIR=$DEBIAN_BASE_DIR/usr/local/bin +AVALANCHE_LIB_DIR=$DEBIAN_BASE_DIR/usr/local/lib/avalanchego +TEMPLATE=.github/workflows/debian/template +DEBIAN_CONF=$DEBIAN_BASE_DIR/DEBIAN + +mkdir -p $DEBIAN_BASE_DIR +mkdir -p $DEBIAN_CONF +mkdir -p $AVALANCHE_BUILD_BIN_DIR +mkdir -p $AVALANCHE_LIB_DIR + +OK=`cp ./build/avalanchego $AVALANCHE_BUILD_BIN_DIR` +if [[ $OK -ne 0 ]]; then + exit $OK; +fi +OK=`cp ./build/plugins/evm $AVALANCHE_LIB_DIR` +if [[ $OK -ne 0 ]]; then + exit $OK; +fi +OK=`cp $TEMPLATE/control $DEBIAN_CONF` +if [[ $OK -ne 0 ]]; then + exit $OK; +fi + +echo "Build debian package..." +cd $PKG_ROOT +echo "Tag: $TAG" +NEW_VERSION_STRING="Version: $TAG" +sed -i "s/Version.*/$NEW_VERSION_STRING/g" debian/DEBIAN/control +dpkg-deb --build debian avalanchego-linux_$TAG.deb +aws s3 cp avalanchego-linux_$TAG.deb s3://$BUCKET/linux/ diff --git a/.github/workflows/build-linux-release.yml b/.github/workflows/build-linux-release.yml new file mode 100644 index 000000000000..c2c2107dfeba --- /dev/null +++ b/.github/workflows/build-linux-release.yml @@ -0,0 +1,49 @@ +# Build a debian package from the avalanchego repo + +name: build-linux-release + +# Controls when the action will run. +on: + push: + tags: + - '*' # Push events to every tag + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-18.04 + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Runs a single command using the runners shell + - name: Build the avalanchego binaries + run: ./scripts/build.sh + + - name: Install aws cli + run: sudo apt-get install awscli + + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + shell: bash + + - name: Create debian package structure + run: ./.github/workflows/build-deb-pkg.sh + env: + AWS_ACCESS_KEY_ID: ${{ secrets.UPLOAD_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.UPLOAD_KEY }} + TAG: ${{ steps.get_version.outputs.VERSION }} + BUCKET: ${{ secrets.BUCKET }} + + - name: Create tgz package structure + run: ./.github/workflows/build-tgz-pkg.sh + env: + AWS_ACCESS_KEY_ID: ${{ secrets.UPLOAD_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.UPLOAD_KEY }} + TAG: ${{ steps.get_version.outputs.VERSION }} + BUCKET: ${{ secrets.BUCKET }} diff --git a/.github/workflows/build-macos-release.yml b/.github/workflows/build-macos-release.yml new file mode 100644 index 000000000000..56320b57dfa9 --- /dev/null +++ b/.github/workflows/build-macos-release.yml @@ -0,0 +1,44 @@ +# Build a macos release from the avalanchego repo + +name: build-macos-release + +# Controls when the action will run. +on: + push: + tags: + - '*' # Push events to every tag + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: macos-10.15 + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Runs a single command using the runners shell + - name: Build the avalanchego binaries + run: ./scripts/build.sh + + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + shell: bash + + - name: Install aws cli + run: | + curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" + sudo installer -pkg AWSCLIV2.pkg -target / + + - name: Create zip file + run: 7z a avalanchego-macos-${{ steps.get_version.outputs.VERSION }}.zip build/avalanchego build/plugins + + - name: Upload file to S3 + run: aws s3 cp avalanchego-macos-${{ steps.get_version.outputs.VERSION }}.zip s3://{{ secrets.BUCKET }}/macos/ + env: + AWS_ACCESS_KEY_ID: ${{ secrets.UPLOAD_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.UPLOAD_KEY }} diff --git a/.github/workflows/build-tgz-pkg.sh b/.github/workflows/build-tgz-pkg.sh new file mode 100755 index 000000000000..5399e103d462 --- /dev/null +++ b/.github/workflows/build-tgz-pkg.sh @@ -0,0 +1,20 @@ +PKG_ROOT=/tmp +VERSION=$TAG +AVALANCHE_ROOT=$PKG_ROOT/avalanchego-$VERSION + +mkdir -p $AVALANCHE_ROOT + +OK=`cp ./build/avalanchego $AVALANCHE_ROOT` +if [[ $OK -ne 0 ]]; then + exit $OK; +fi +OK=`cp -r ./build/plugins $AVALANCHE_ROOT` +if [[ $OK -ne 0 ]]; then + exit $OK; +fi + +echo "Build tgz package..." +cd $PKG_ROOT +echo "Version: $VERSION" +tar -czvf "avalanchego-linux-$VERSION.tar.gz" avalanchego-$VERSION +aws s3 cp avalanchego-linux-$VERSION.tar.gz s3://$BUCKET/linux/ diff --git a/.github/workflows/build-win-release.yml b/.github/workflows/build-win-release.yml new file mode 100644 index 000000000000..426044243417 --- /dev/null +++ b/.github/workflows/build-win-release.yml @@ -0,0 +1,47 @@ +# Build a windows release from the avalanchego repo + +name: build-win-release + +# Controls when the action will run. +on: + push: + tags: + - '*' # Push events to every tag + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: windows-2019 + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + shell: bash + + # Runs a single command using the runners shell + - name: Build the avalanchego binaries + run: ./scripts/build.sh + shell: bash + + - name: Create zip + run: | + mv .\build\avalanchego .\build\avalanchego.exe + mv .\build\plugins\evm .\build\plugins\evm.exe + Compress-Archive -Path .\build\avalanchego.exe,.\build\plugins -DestinationPath .\build\avalanchego-win-${{ steps.get_version.outputs.VERSION }}-experimental.zip + + - name: Install aws cli + env: + AWS_ACCESS_KEY_ID: ${{ secrets.UPLOAD_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.UPLOAD_KEY }} + run: | + Install-Module -Name AWS.Tools.Installer -Force + Install-AWSToolsModule AWS.Tools.EC2,AWS.Tools.S3 -CleanUp -Force + Write-S3Object -BucketName ${{ secrets.BUCKET }} -File .\build\avalanchego-win-${{ steps.get_version.outputs.VERSION }}-experimental.zip -Key windows/avalanchego-win-${{ steps.get_version.outputs.VERSION }}-experimental.zip + diff --git a/.github/workflows/debian/template/control b/.github/workflows/debian/template/control new file mode 100644 index 000000000000..ace70c066932 --- /dev/null +++ b/.github/workflows/debian/template/control @@ -0,0 +1,8 @@ +Package: avalanchego +Version: 0.1.0 +Section: misc +Priority: optional +Architecture: amd64 +Depends: +Maintainer: Fabio Barone +Description: The Avalanche platform binaries