From 0053d74e6c4d9c3a45fa9e66bd3c678e9dd090ca Mon Sep 17 00:00:00 2001 From: Jose Quintana <1700322+joseluisq@users.noreply.github.com> Date: Fri, 7 Feb 2025 07:15:42 +0100 Subject: [PATCH] refactor: improve post release updates ci workflow (#525) --- .github/workflows/release.updates.yml | 14 ++++++++++++++ docs/content/download-and-install.template.md | 2 +- scripts/ci/post_release_updates.sh | 7 ++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.updates.yml b/.github/workflows/release.updates.yml index 100d6f1f..b85f9d13 100644 --- a/.github/workflows/release.updates.yml +++ b/.github/workflows/release.updates.yml @@ -3,6 +3,8 @@ on: release: types: - published +permissions: + contents: write jobs: checksum_file: @@ -22,6 +24,18 @@ jobs: - name: Post release updates shell: bash env: + UPLOAD_CHECKSUM: true GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | scripts/ci/post_release_updates.sh + + - name: Commit post release updates changes + shell: bash + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git config --global user.name 'Jose Quintana' + git config --global user.email '1700322+joseluisq@users.noreply.github.com' + git add scripts/installer.sh docs/content/download-and-install.md docs/content/download-and-install.template.md + git commit -m "docs: ${{ env.SERVER_VERSION }} [skip ci]" + git push diff --git a/docs/content/download-and-install.template.md b/docs/content/download-and-install.template.md index d7faa6af..2f43040a 100644 --- a/docs/content/download-and-install.template.md +++ b/docs/content/download-and-install.template.md @@ -30,7 +30,7 @@ curl --proto '=https' --tlsv1.2 -sSfL https://get.static-web-server.net | sh Alternatively, you can install a specific version of SWS to a custom location by setting environment variables. ```sh -export SWS_INSTALL_VERSION="2.35.0" # full list at https://github.com/static-web-server/static-web-server/tags +export SWS_INSTALL_VERSION="{{RELEASE_VERSION_NUM}}" # full list at https://github.com/static-web-server/static-web-server/tags export SWS_INSTALL_DIR="~/.local/bin" curl --proto '=https' --tlsv1.2 -sSfL https://get.static-web-server.net | sh ``` diff --git a/scripts/ci/post_release_updates.sh b/scripts/ci/post_release_updates.sh index 2433a2d9..8b3b3b1b 100755 --- a/scripts/ci/post_release_updates.sh +++ b/scripts/ci/post_release_updates.sh @@ -21,6 +21,7 @@ cd $release_dir server_version_num=$(echo $SERVER_VERSION | sed "s/v//") # Download precompiled binary assets +echo "Downloading release target assets..." while read -r file_url; do curl -LO --progress-bar $file_url done < <(cat $release_json | jq -r ".assets[] | .browser_download_url") @@ -92,9 +93,9 @@ rm -rf docs/content/*.bk echo "Download and install page generated!" # Update current installer script version -sed -i$sed_bk -e "s/version=\".*\"/version=\"$server_version_num\"/g" $cwd/scripts/installer.sh -rm -rf $cwd/scripts/*.bk -echo "Installer script $server_version_num version updated!" +sed -i$sed_bk -e "s/SWS_INSTALL_VERSION\:\-\".*\"/SWS_INSTALL_VERSION\:\-\"$server_version_num\"/g" $cwd/scripts/installer.sh +rm -rf scripts/*.bk +echo "Installer script's version was updated to $server_version_num!" echo