Template
mirror of
https://github.com/MorpheApp/morphe-patches-template.git
synced 2026-12-01 00:19:34 +00:00
chore: Merge branch dev to main (#52)
This commit is contained in:
3 files changed
+32
-58
No files matched your search
@@ -1,29 +0,0 @@
|
||||
name: Build pull request
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
branches:
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
|
||||
- name: Cache Gradle
|
||||
uses: burrunan/gradle-cache-action@v3
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: ./gradlew :patches:buildAndroid --no-daemon
|
||||
@@ -10,9 +10,6 @@ permissions:
|
||||
pull-requests: write
|
||||
contents: read
|
||||
|
||||
env:
|
||||
MESSAGE: Merge branch `${{ github.head_ref || github.ref_name }}` to `main`
|
||||
|
||||
jobs:
|
||||
pull-request:
|
||||
name: Open pull request
|
||||
@@ -22,10 +19,24 @@ jobs:
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Open pull request
|
||||
uses: repo-sync/pull-request@v2
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
destination_branch: 'main'
|
||||
pr_title: 'chore: ${{ env.MESSAGE }}'
|
||||
pr_body: 'This pull request will ${{ env.MESSAGE }}.'
|
||||
pr_draft: true
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SOURCE_BRANCH: ${{ github.ref_name }}
|
||||
TARGET_BRANCH: main
|
||||
run: |
|
||||
# Check if PR already exists (base=main, head=dev)
|
||||
if gh pr list --base "$TARGET_BRANCH" --head "$SOURCE_BRANCH" --json number | jq -e '. | length > 0' >/dev/null; then
|
||||
echo "Pull request already exists."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Try to create the PR
|
||||
gh pr create \
|
||||
--base "$TARGET_BRANCH" \
|
||||
--head "$SOURCE_BRANCH" \
|
||||
--title 'chore: Merge branch `dev` to `main`' \
|
||||
--body "When dev (pre-release) is ready, then merge this pull request to create a new stable release." \
|
||||
|| {
|
||||
echo "::error::Pull request creation failed. Ensure 'Allow GitHub Actions to create and approve pull requests' is enabled in the repo Settings > Actions > General > Workflow permissions"
|
||||
exit 1
|
||||
}
|
||||
@@ -3,9 +3,6 @@ name: Release
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
release:
|
||||
@@ -28,21 +25,6 @@ jobs:
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
|
||||
# Verify the build isn't broken. This is required for
|
||||
# chore commits where semantic release doesn't run.
|
||||
- name: Build
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: ./gradlew :patches:buildAndroid
|
||||
|
||||
# Cleaning up is necessary otherwise semantic release will create two artifacts,
|
||||
# One artifact of the current release number and a second of the new release.
|
||||
# Semantic release runs its own compilation step and
|
||||
- name: Cleanup build
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: ./gradlew clean
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
@@ -52,8 +34,10 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
# Semantic release runs its own Gradle build command.
|
||||
# Only dev and main branch will generate a release as specified by .releaserc
|
||||
- name: Release
|
||||
uses: cycjimmy/semantic-release-action@v5
|
||||
uses: cycjimmy/semantic-release-action@v6
|
||||
id: release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -64,3 +48,11 @@ jobs:
|
||||
with:
|
||||
subject-name: 'Morphe Patches ${{ steps.release.outputs.new_release_git_tag }}'
|
||||
subject-path: patches/build/libs/patches-*.mpp
|
||||
|
||||
# Always verify compilation when semantic-release did not publish a release.
|
||||
# This covers non-main/dev branches, chore commits, docs commits, etc.
|
||||
- name: Verify project compiles
|
||||
if: steps.release.outputs.new_release_published != 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: ./gradlew :patches:buildAndroid clean --no-daemon
|
||||
Reference in new issue
Block a user