From 2e4248e40eba08b9237d4ca803ef3496e38dee95 Mon Sep 17 00:00:00 2001 From: wdvxdr Date: Sat, 27 Mar 2021 12:54:35 +0800 Subject: [PATCH] update tag --- .github/workflows/release.yml | 11 +---------- scripts/upload_dist.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 scripts/upload_dist.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0c9580e..e9d4db8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,13 +36,4 @@ jobs: path: upstream/dist - name: Update Dist - run: | - cp dist/*.tar.gz upstream/dist/ - cp dist/*.zip upstream/dist/ - cd upstream/dist - git config --local user.name 'Github Actions' - git config --local user.email 'github-actions@users.noreply.github.com' - git add --all - git commit -m "update to ${GITHUB_REF#"refs/tags/"}" - git push - + run: ./scripts/upload_dist.sh diff --git a/scripts/upload_dist.sh b/scripts/upload_dist.sh new file mode 100644 index 0000000..4504efe --- /dev/null +++ b/scripts/upload_dist.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +if [ "$GITHUB_ACTIONS" != "true" ]; then + echo "This script is only meant to be run in GitHub Actions." + exit 1 +fi + +cp -f dist/*.tar.gz upstream/dist/ +cp -f dist/*.zip upstream/dist/ +cd upstream/dist +LATEST_VERSION="${GITHUB_REF#"refs/tags/"}" +git config --local user.name 'Github Actions' +git config --local user.email 'github-actions@users.noreply.github.com' +git add --all +git commit -m "update to $LATEST_VERSION" +git tag -d "${GITHUB_REF#"refs/tags/"}" +git tag "${GITHUB_REF#"refs/tags/"}" +git push +git push --tags \ No newline at end of file