Skip to content

Commit

Permalink
build: ✨ Minor workflow refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
JamsRepos committed Jun 2, 2024
1 parent 15acbef commit a8ff235
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 26 deletions.
14 changes: 1 addition & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
24 changes: 12 additions & 12 deletions release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
`
},
],
[
Expand Down Expand Up @@ -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`
},
],
],
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.4
1.0.5

0 comments on commit a8ff235

Please sign in to comment.