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