Skip to content

Merge pull request #35 from adobe-commerce/changeset-release/main #11

Merge pull request #35 from adobe-commerce/changeset-release/main

Merge pull request #35 from adobe-commerce/changeset-release/main #11

Workflow file for this run

name: Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: npm install
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Run version command
run: npx changeset version
- name: Check for changes
id: check
run: |
if git diff --quiet; then
echo "has_changes=false" >> "$GITHUB_OUTPUT"
else
echo "has_changes=true" >> "$GITHUB_OUTPUT"
fi
- name: Create or update release PR
if: steps.check.outputs.has_changes == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
BRANCH="changeset-release/main"
git checkout -b "$BRANCH"
git add -A
git commit -m "chore: bump version"
git push origin "$BRANCH" --force
gh pr create \
--title "chore: bump version" \
--body "Version bump from pending changesets." \
--base main \
--head "$BRANCH" \
|| gh pr edit "$BRANCH" --title "chore: bump version"
- name: Tag release
if: steps.check.outputs.has_changes == 'false'
run: |
npx changeset tag
git push --tags