Skip to content

Commit

Permalink
fix(maybe??): idk
Browse files Browse the repository at this point in the history
  • Loading branch information
VampireChicken12 committed Aug 29, 2023
1 parent 9e086ed commit 02a78e8
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,15 @@ jobs:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: npx semantic-release
- name: Update package.json Version
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
# Extract the new version from the Semantic Release output
NEW_VERSION=$(npx semantic-release --dry-run | grep "New version:" | awk '{print $3}')
# Update package.json with the new version
node -e "const fs = require('fs'); const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8')); packageJson.version = '$NEW_VERSION'; fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2));"
# Install Semantic Release and extract the new version
npx semantic-release --dry-run | grep "New version:" | awk '{print $3}' > new_version.txt
# Verify that package.json has been updated
cat package.json
# Use npm version to update the package.json
npm version $(cat new_version.txt) -m "chore(release): %s"
# Configure Git with GitHub secrets
git config user.name "${{ secrets.GH_USERNAME }}"
git config user.email "${{ secrets.GH_EMAIL }}"
# Commit the updated package.json
git commit -am "chore(release): Bump version to $NEW_VERSION"
git push
# Push the changes back to the repository
git push --follow-tags
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ${{github.workspace}}

0 comments on commit 02a78e8

Please sign in to comment.