chore(main): release 1.6.3 #119
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Automatic Versioning | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Cache Node.js dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.bun | |
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | |
restore-keys: | | |
${{ runner.os }}-bun- | |
- name: Set up Bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: Install dependencies | |
run: bun install | |
- name: Run bundle | |
run: bun run bundle | |
- name: Commit bundle results | |
if: github.event_name == 'pull_request' | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "BeatForge CI" | |
# Fetch all branches | |
git fetch origin | |
# Check out the branch | |
git checkout ${{ github.event.pull_request.head.ref }} | |
# Check if there are any changes | |
if [ -n "$(git status --porcelain)" ]; then | |
git add . | |
git commit -m "chore: bundle update" | |
# Pull changes from the remote repository to avoid conflicts | |
git pull --rebase origin ${{ github.event.pull_request.head.ref }} | |
git push origin HEAD:${{ github.event.pull_request.head.ref }} | |
else | |
echo "No changes to commit" | |
fi | |
- name: Release Please | |
uses: google-github-actions/release-please-action@v3 | |
id: release | |
if: github.event_name == 'push' | |
with: | |
token: ${{ secrets.RELEASE_GITHUB_TOKEN }} | |
package-name: "init-beatsaber" | |
release-type: node | |
- name: Tag and push subversions | |
if: github.event_name == 'push' && steps.release.outputs.releases_created | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "BeatForge CI" | |
git fetch --tags | |
# Delete local tags if they exist | |
git tag -d v${{ steps.release.outputs.major }} || true | |
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true | |
# Delete remote tags if they exist | |
git push origin :v${{ steps.release.outputs.major }} || true | |
git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true | |
# Create new tags | |
git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}" | |
git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}" | |
# Push new tags | |
git push origin v${{ steps.release.outputs.major }} | |
git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} |