From 59450dfb49fb05e180be8c2ca0995b8f0206e715 Mon Sep 17 00:00:00 2001 From: Qv2ray-dev <59914293+Qv2ray-dev@users.noreply.github.com> Date: Sat, 25 Apr 2020 14:09:10 +0800 Subject: [PATCH] action: update release hash checker --- .github/workflows/hashfile.yml | 47 ++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/hashfile.yml diff --git a/.github/workflows/hashfile.yml b/.github/workflows/hashfile.yml new file mode 100644 index 0000000..7e380f0 --- /dev/null +++ b/.github/workflows/hashfile.yml @@ -0,0 +1,47 @@ +name: Update release files hash + +on: + release: + types: [edited] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - run: echo ::set-env name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) + shell: bash + - run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') + shell: bash + - name: Checking out sources + uses: actions/checkout@master + - name: Hash File + shell: bash + run: | + wget -O release.info https://api.github.com/repos/Qv2ray/${REPOSITORY_NAME}/releases/tags/${VERSION} + cat ./release.info | jq -r ".assets | .[] | .browser_download_url" > download.list + cat ./release.info | jq -r ".assets | .[] | { uploader_id: .uploader.login, asset_name: .name }" > assets.info.json + mkdir files + cd files + for x in $(cat ../download.list); do + wget "$x"; + done; + rm assets.info.json || true + rm sha256.list || true + sha256sum ./* > ../sha256.list + - name: Upload metadata to release + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: assets.info.json + asset_name: assets.info.json + tag: ${{ github.ref }} + overwrite: true + - name: Upload metadata to release + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: sha256.list + asset_name: sha256.list + tag: ${{ github.ref }} + overwrite: true