Merge branch 'staging' into dallin/bus-920-feature-finish-rest-of-permissions

This commit is contained in:
Nate Kelley 2025-01-17 09:46:23 -07:00
commit 7dd102a06f
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
6 changed files with 119 additions and 11 deletions

View File

@ -1,22 +1,69 @@
name: Release
name: Update Version
on:
push:
branches:
- main
# Add permissions configuration
permissions:
contents: write
pull-requests: write
jobs:
release:
version-bump:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Add condition to skip if last commit was a release
if: "!startsWith(github.event.head_commit.message, 'chore(release)')"
- name: Run Release Please
uses: googleapis/release-please-action@v4
steps:
# Step 1: Check out the repository
- name: Checkout Code
uses: actions/checkout@v4
with:
release-type: simple
path: .
fetch-depth: 0 # Fetch all history
token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
skip-github-release: true
# Step 2: Determine Version
- name: Determine Version
id: get_version
run: |
if [ ! -f "version.txt" ]; then
echo "0.0.1" > version.txt
fi
CURRENT_VERSION=$(cat version.txt)
echo "Current Version: $CURRENT_VERSION"
# Split version into components
IFS='.' read -r -a version_parts <<< "$CURRENT_VERSION"
MAJOR="${version_parts[0]}"
MINOR="${version_parts[1]}"
PATCH="${version_parts[2]}"
# Increment patch version
NEW_PATCH=$((PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
echo "New Version: $NEW_VERSION"
# Export versions for later steps
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
# Step 3: Update version.txt if version changes
- name: Update version.txt
if: env.CURRENT_VERSION != env.NEW_VERSION
run: |
echo "$NEW_VERSION" > version.txt
# Step 4: Commit and Push Changes
- name: Commit and Push Changes
if: env.CURRENT_VERSION != env.NEW_VERSION
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

48
.github/workflows/update-version.yml vendored Normal file
View File

@ -0,0 +1,48 @@
name: Update Version
on:
push:
branches:
- main
jobs:
version:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
- name: Get previous version
id: previous_version
run: |
VERSION=$(grep "buster=" version.txt | cut -d'=' -f2)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Conventional Commit Check and Version Bump
id: version_bump
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
default_bump: false
dry_run: true
tag_prefix: ""
- name: Update version.txt
if: steps.version_bump.outputs.new_version != steps.previous_version.outputs.version
run: |
NEW_VERSION="${{ steps.version_bump.outputs.new_version }}"
sed -i "s/buster=.*/buster=$NEW_VERSION/" version.txt
- name: Commit and push if changed
if: steps.version_bump.outputs.new_version != steps.previous_version.outputs.version
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add version.txt
git commit -m "chore: bump version to ${{ steps.version_bump.outputs.new_version }}"
git push

2
.gitignore vendored
View File

@ -60,3 +60,5 @@ Cargo.lock
# Node.js dependencies
node_modules/
.secrets

View File

@ -0,0 +1,10 @@
{
"packages": {
".": {
"release-type": "simple",
"changelog-path": "CHANGELOG.md",
"prerelease": true
}
},
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
}

View File

@ -19,7 +19,7 @@
</div>
<div>
<a href="https://github.com/buster-so/warehouse/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-red.svg?style=flat-square" alt="MIT License"></a>
<a href="https://github.com/buster-so/warehouse/blob/main/LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/License-MIT-red.svg?style=flat-square" ></a>
<a href="https://www.ycombinator.com/companies/buster"><img src="https://img.shields.io/badge/Y%20Combinator-W24-orange?style=flat-square" alt="Y Combinator W24"></a>
</div>
</div>

View File

@ -0,0 +1 @@
0.0.5