From c00d5c4ea90b089c20c22fe07003f5fc317db61a Mon Sep 17 00:00:00 2001 From: xxxuuu Date: Fri, 11 Jul 2025 18:38:14 +0800 Subject: [PATCH] support to push artifacts in release workflow Signed-off-by: xxxuuu --- .github/workflows/release.yml | 25 ++++++++++++++++++++++++- scripts/getm3fs | 4 +--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5052c43..395ee0b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,8 @@ name: Release +permissions: + contents: write + on: push: tags: @@ -17,19 +20,39 @@ jobs: - uses: actions/setup-go@v5 with: go-version-file: go.mod + - name: Set-up s5cmd + uses: peak/action-setup-s5cmd@main + with: + version: v2.3.0 - name: Build run: | GOARCH=${{ matrix.arch }} make build - name: Package binaries run: | M3FS_VER=m3fs_${{ github.ref_name }}_${{ matrix.arch }} + M3FS_LAT=m3fs_latest_${{ matrix.arch }} cd bin tar -zcf $M3FS_VER.tar.gz m3fs sha256sum $M3FS_VER.tar.gz > $M3FS_VER.tar.gz.sha256sum + cp $M3FS_VER.tar.gz $M3FS_LAT.tar.gz + sha256sum $M3FS_LAT.tar.gz > $M3FS_LAT.tar.gz.sha256sum - uses: softprops/action-gh-release@v2 with: draft: true generate_release_notes: true + make_latest: true files: | bin/m3fs_${{ github.ref_name }}_${{ matrix.arch }}.tar.gz - bin/m3fs_${{ github.ref_name }}_${{ matrix.arch }}.tar.gz.sha256sum \ No newline at end of file + bin/m3fs_${{ github.ref_name }}_${{ matrix.arch }}.tar.gz.sha256sum + - name: Upload artifacts to S3 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + ENDPOINT: ${{ vars.ARTIFACT_ENDPOINT }} + BUCKET: ${{ vars.ARTIFACT_BUCKET }} + run: | + cd bin + s5cmd --endpoint-url ${{ env.ENDPOINT }} cp m3fs_${{ github.ref_name }}_${{ matrix.arch }}.tar.gz s3://${{ env.BUCKET }}/m3fs/ + s5cmd --endpoint-url ${{ env.ENDPOINT }} cp m3fs_${{ github.ref_name }}_${{ matrix.arch }}.tar.gz.sha256sum s3://${{ env.BUCKET }}/m3fs/ + s5cmd --endpoint-url ${{ env.ENDPOINT }} cp m3fs_latest_${{ matrix.arch }}.tar.gz s3://${{ env.BUCKET }}/m3fs/ + s5cmd --endpoint-url ${{ env.ENDPOINT }} cp m3fs_latest_${{ matrix.arch }}.tar.gz.sha256sum s3://${{ env.BUCKET }}/m3fs/ diff --git a/scripts/getm3fs b/scripts/getm3fs index 85c0e36..c011722 100755 --- a/scripts/getm3fs +++ b/scripts/getm3fs @@ -40,9 +40,7 @@ if [ -z "${ARCH}" ]; then esac fi -VERSION=$(basename $(curl -s -L -I -o /dev/null -w '%{url_effective}' "https://github.com/open3fs/m3fs/releases/latest")) -echo "The latest version of m3fs is ${VERSION}" - +VERSION=latest DOWNLOAD_URL="https://artifactory.open3fs.com/m3fs/m3fs_${VERSION}_${ARCH}.tar.gz" echo "" echo "Downloading m3fs ${VERSION} from ${DOWNLOAD_URL} ..."