From 2662e31bc13175ec6864f0ffdfa5e724aae545c0 Mon Sep 17 00:00:00 2001 From: Haodi <82733821@qq.com> Date: Tue, 24 Sep 2024 23:30:19 +0800 Subject: [PATCH] add version file (#22) --- .github/workflows/ci-s3.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/ci-s3.yml b/.github/workflows/ci-s3.yml index eefd41694..35c414edb 100644 --- a/.github/workflows/ci-s3.yml +++ b/.github/workflows/ci-s3.yml @@ -60,6 +60,7 @@ jobs: echo "Version extracted: $VERSION" echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "VERSION_META=$VERSION_META" >> $GITHUB_ENV - name: Build the geth binary run: | @@ -97,6 +98,7 @@ jobs: COMMIT_HASH=$(git rev-parse --short HEAD) FOLDER_NAME="geth-${{ matrix.platform }}-${VERSION}-${COMMIT_HASH}" ARCHIVE_NAME="${FOLDER_NAME}.tar.gz" + PUBLIC_DOWNLOAD_URL="https://$S3_BUCKET.s3.us-west-1.amazonaws.com/geth-public/$ARCHIVE_NAME" binary_name=./build/bin/geth if [ "$GOOS" = "windows" ]; then @@ -113,6 +115,17 @@ jobs: aws s3 cp s3://$S3_BUCKET/geth/manifest.txt manifest.txt --quiet || touch manifest.txt echo "$TIMESTAMP" >> manifest.txt aws s3 cp manifest.txt s3://$S3_BUCKET/geth/manifest.txt --quiet + + # Update version file + aws s3 cp s3://$S3_BUCKET/geth-public/version.txt version.txt --quiet || printf "File Name\t\t\tVerison\t\t\t\tCommit Hash\t\tTimestamp\n" > version.txt + + if [ "${VERSION_META}" != "stable" ]; then + printf "$VERSION-$COMMIT_HASH\t\t$VERSION\t\t\t$COMMIT_HASH\t\t\t$TIMESTAMP\n" >> version.txt + else + printf "$VERSION-$COMMIT_HASH\t\t\t$VERSION\t\t\t\t$COMMIT_HASH\t\t\t$TIMESTAMP\n" >> version.txt + fi + + aws s3 cp version.txt s3://$S3_BUCKET/geth-public/version.txt --quiet fi mkdir $FOLDER_NAME @@ -134,6 +147,18 @@ jobs: exit 1 fi + echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_ENV + echo "PUBLIC_DOWNLOAD_URL=$PUBLIC_DOWNLOAD_URL" >> $GITHUB_ENV + + - name: Add binary version back to PR + if: matrix.platform == 'linux-amd64' + uses: mshick/add-pr-comment@v2 + with: + message: | + ### Binary uploaded successfully 🎉 + 📦 **Version Name:** ${{ env.VERSION }}-${{ env.COMMIT_HASH }} + 📦 **Download Source:** [AWS S3](${{ env.PUBLIC_DOWNLOAD_URL }}) + cleanup: runs-on: ubuntu-latest needs: build_and_push