Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Auto Semver #18

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 39 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,49 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.7

# Create Release Semver
- name: Generate Semantic Version
id: semver
uses: K-Phoen/semver-release-action@master
with:
release_branch: main
release_strategy: none
- name: Get the current branch name
id: get_branch
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: Find related PR
id: find_pr
run: |
PR_URL=$(gh pr list --base ${{ env.branch }} --state=all --json url --limit=1 --jq '.[0].url')
echo "pr_url=$PR_URL" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch PR labels
id: get_labels
if: env.pr_url != ''
run: |
LABELS=$(gh pr view ${{ env.pr_url }} --json labels --jq '.labels | map(.name) | join(",")')
echo "labels=$LABELS" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set default version incrementer
run: echo "versionIncrementer=incrementPatch" >> $GITHUB_ENV
- name: Check for enhancement / breaking-change labels
if: env.labels != ''
run: |
LABELS="${{ env.labels }}"
if [[ $LABELS == *"enhancement"* ]]; then
echo "versionIncrementer=incrementMinor" >> $GITHUB_ENV
fi
if [[ $LABELS == *"breaking-change"* ]]; then
echo "versionIncrementer=incrementMajor" >> $GITHUB_ENV
fi
- name: Display Version Incrementer
run: echo "Version Incrementer == ${{ env.versionIncrementer }}"
- name: Create Release
if: |
github.ref == 'refs/heads/main' &&
github.repository == 'dragon-okinawa/dragon'
run: gradle createRelease -Prelease.versionIncrementer=${{ env.versionIncrementer }}

# Set Project Version
- name: Set Frontend Version
run: npm version ${{ steps.semver.outputs.tag }}
run: npm version from-git --no-git-tag-version
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins {
id 'pl.allegro.tech.build.axion-release' version '1.18.5'
}
Loading