mirror of https://github.com/buster-so/buster.git
fix: use a node pipeline
This commit is contained in:
parent
20ba771a8d
commit
6a67afe5cb
|
@ -1,37 +1,76 @@
|
||||||
|
name: Update Version
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
|
# Add permissions configuration
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
||||||
name: release-please
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release-please:
|
version-bump:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: googleapis/release-please-action@v4
|
# Step 1: Check out the repository
|
||||||
id: release
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
|
fetch-depth: 0 # Fetch all history
|
||||||
token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
|
token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
|
||||||
skip-github-pull-request: true
|
|
||||||
release-type: simple
|
# Step 2: Set up Node.js
|
||||||
prerelease: true
|
- name: Set up Node.js
|
||||||
version-file: version.txt
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
- uses: actions/checkout@v4
|
node-version: '20'
|
||||||
if: ${{ steps.release.outputs.release_created }}
|
|
||||||
|
# Step 3: Install Dependencies
|
||||||
- name: Update version and push
|
- name: Install Dependencies
|
||||||
if: ${{ steps.release.outputs.release_created }}
|
run: npm install standard-version --save-dev
|
||||||
|
|
||||||
|
# Step 4: Determine New Version
|
||||||
|
- name: Determine Version
|
||||||
|
id: get_version
|
||||||
run: |
|
run: |
|
||||||
git config user.name github-actions[bot]
|
# Debug: List directory contents
|
||||||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
echo "Listing directory contents:"
|
||||||
git add .
|
ls -la
|
||||||
git commit -m "chore: update version to ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}"
|
|
||||||
git push
|
# Debug: Check if version.txt exists
|
||||||
env:
|
if [ -f "version.txt" ]; then
|
||||||
GITHUB_TOKEN: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
|
echo "version.txt exists"
|
||||||
|
else
|
||||||
|
echo "version.txt does not exist"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Read the current version
|
||||||
|
CURRENT_VERSION=$(cat version.txt)
|
||||||
|
echo "Current Version: $CURRENT_VERSION"
|
||||||
|
|
||||||
|
# Get the next version using standard-version
|
||||||
|
NEW_VERSION=$(npx standard-version --dry-run | grep "tagging release" | awk '{print $NF}')
|
||||||
|
echo "New Version: $NEW_VERSION"
|
||||||
|
|
||||||
|
# Export both versions for later steps
|
||||||
|
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
|
||||||
|
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# Step 5: Update version.txt if version changes
|
||||||
|
- name: Update version.txt
|
||||||
|
if: env.CURRENT_VERSION != env.NEW_VERSION # Run only if the versions are different
|
||||||
|
run: |
|
||||||
|
echo "$NEW_VERSION" > version.txt
|
||||||
|
|
||||||
|
# Step 6: Commit and Push Changes
|
||||||
|
- name: Commit and Push Changes
|
||||||
|
if: env.CURRENT_VERSION != env.NEW_VERSION # Run only if the versions are different
|
||||||
|
run: |
|
||||||
|
git config --global user.name "github-actions[bot]"
|
||||||
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git add version.txt
|
||||||
|
git commit -m "chore(release): update version to $NEW_VERSION"
|
||||||
|
git push "https://${{ github.actor }}:${{ secrets.MY_RELEASE_PLEASE_TOKEN }}@github.com/${{ github.repository }}.git" HEAD:main
|
Loading…
Reference in New Issue