From f3605a86a22c0ecfec85a6bbc08d320e837abe8a Mon Sep 17 00:00:00 2001 From: Dexoron Date: Wed, 12 Aug 2026 23:35:44 +0800 Subject: [PATCH] Add Yandex S3 --- .github/workflows/release.yml | 61 ++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ab1c4a4..a1661d9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,6 +45,10 @@ on: description: "Update Homebrew tap" type: boolean default: false + run_s3: + description: "Mirror Release to Yandex Object Storage (S3)" + type: boolean + default: false permissions: contents: write @@ -1253,4 +1257,59 @@ jobs: # sudo snap install --classic --dangerous dcrup_*.snap # # publish-snap: - # if: ... \ No newline at end of file + # if: ... + + # ── Mirror Release to Yandex Object Storage (S3) ───────────────────────── + publish-s3: + if: | + (github.event_name == 'push' && needs.setup.outputs.prerelease == 'false') || + (github.event_name == 'workflow_dispatch' && github.event.inputs.run_s3 == 'true') + needs: + - setup + - create-release + - man-pages + - build-linux + - build-macos + - build-bsd + - build-windows + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + ref: ${{ needs.setup.outputs.tag }} + + - name: Prepare Directory and Download GitHub Release Assets + id: fetch-assets + shell: bash + run: | + set -euo pipefail + TAG="${{ needs.setup.outputs.tag }}" + + mkdir -p dist + cd dist + + echo "Downloading assets from GitHub Release for tag: ${TAG}" + gh release download "${TAG}" --dir . --repo "${{ github.repository }}" + + cd .. + echo "Archiving source code..." + git archive --format=tar.gz --prefix="dcr-${TAG}/" "${TAG}" -o "dist/dcr-src-${TAG}.tar.gz" + git archive --format=zip --prefix="dcr-${TAG}/" "${TAG}" -o "dist/dcr-src-${TAG}.zip" + + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload Everything to Yandex Object Storage + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_EC2_METADATA_DISABLED: true + shell: bash + run: | + set -euo pipefail + TAG="${{ needs.setup.outputs.tag }}" + + aws s3 sync dist/ "s3://${{ secrets.S3_BUCKET_NAME }}/${TAG}/" \ + --endpoint-url https://storage.yandexcloud.net \ + --region ru-central1 \ No newline at end of file