From a8ff2350ccf2732ee1ed7eab2fbb9bda5def7459 Mon Sep 17 00:00:00 2001 From: Jam <1347620+JamsRepos@users.noreply.github.com> Date: Sun, 2 Jun 2024 22:41:04 +0100 Subject: [PATCH] build: :sparkles: Minor workflow refactoring --- .github/workflows/release.yml | 14 +------------- release.config.js | 24 ++++++++++++------------ version.txt | 2 +- 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5c541e5..ddfec95 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,16 +24,4 @@ jobs: id: release run: npm run semantic-release env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - - - name: Commit and push updated files - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_message: "chore: update CDN links to version $(cat VERSION.txt)" - branch: main - file_pattern: | - README.md - theme/complete.css - VERSION.txt - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} \ No newline at end of file diff --git a/release.config.js b/release.config.js index ad3e0c8..aa4da12 100644 --- a/release.config.js +++ b/release.config.js @@ -16,7 +16,13 @@ const config = { [ "@semantic-release/exec", { - prepareCmd: 'echo "Branch: ${branch}"', + prepareCmd: 'echo "${nextRelease.version}" > VERSION.txt', + successCmd: ` + echo "Updating CDN links to version \${nextRelease.version}" && + for file in $(find . -name "README.md" -o -name "complete.css"); do + sed -i "s|https://cdn.jsdelivr.net/gh/JamsRepos/Jamfin@[0-9.]*|https://cdn.jsdelivr.net/gh/JamsRepos/Jamfin@\${nextRelease.version}|g" "$file" + done + ` }, ], [ @@ -61,22 +67,16 @@ const config = { changelogFile: "CHANGELOG.md", }, ], - [ - "@semantic-release/exec", - { - prepareCmd: 'echo "${nextRelease.version}" > VERSION.txt', - successCmd: ` - echo "Updating CDN links to version \${nextRelease.version}" && - find . -name "README.md" -type f -exec sed -i "s|https://cdn.jsdelivr.net/gh/JamsRepos/Jamfin@[0-9.]*|https://cdn.jsdelivr.net/gh/JamsRepos/Jamfin@\${nextRelease.version}|g" {} \\; && - find . -name "complete.css" -type f -exec sed -i "s|https://cdn.jsdelivr.net/gh/JamsRepos/Jamfin@[0-9.]*|https://cdn.jsdelivr.net/gh/JamsRepos/Jamfin@\${nextRelease.version}|g" {} \\; - ` - }, - ], [ "@semantic-release/git", { assets: ["CHANGELOG.md", "VERSION.txt", "README.md", "theme/complete.css"], message: "chore: 🧹 \${nextRelease.version}\n\n\${nextRelease.notes}", + gitPushArgs: [ + "--follow-tags", + "--set-upstream origin main" + ], + gitCredentials: `https://${process.env.GH_TOKEN}@github.com/JamsRepos/Jamfin.git` }, ], ], diff --git a/version.txt b/version.txt index ee90284..90a27f9 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.4 +1.0.5