From 8cd07d626a1b2f87e58ec65e93ac7e246c2d92c5 Mon Sep 17 00:00:00 2001 From: MarkG Date: Fri, 27 Dec 2024 14:05:49 +0700 Subject: [PATCH] test --- .github/configs/changelog-config.json | 32 +++++++ .../workflows/create_release_pull_request.yml | 85 +++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 .github/configs/changelog-config.json create mode 100644 .github/workflows/create_release_pull_request.yml diff --git a/.github/configs/changelog-config.json b/.github/configs/changelog-config.json new file mode 100644 index 00000000..179678d8 --- /dev/null +++ b/.github/configs/changelog-config.json @@ -0,0 +1,32 @@ +{ + "categories": [ + { + "title": "## โœจ Features", + "labels": [ + "type: feature" + ] + }, + { + "title": "## ๐Ÿ› Bug fixes", + "labels": [ + "type: bug" + ] + }, + { + "title": "## ๐Ÿงน Chores", + "labels": [ + "type: chore" + ] + }, + { + "title": "## Others", + "exclude_labels": [ + "type: feature", + "type: bug", + "type: chore", + "type: release" + ] + } + ], + "max_pull_requests": 200 + } diff --git a/.github/workflows/create_release_pull_request.yml b/.github/workflows/create_release_pull_request.yml new file mode 100644 index 00000000..70349b9b --- /dev/null +++ b/.github/workflows/create_release_pull_request.yml @@ -0,0 +1,85 @@ +name: Create Release Pull Request + +on: + pull_request + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + create_release_pull_request: + name: Create Release Pull Request + runs-on: macOS-latest + timeout-minutes: 30 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Bundle install + run: bundle install + + - name: Start Install Script for SwiftUI Template App + run: swift run --package-path Scripts/Swift/iOSTemplateMaker iOSTemplateMaker make --bundle-id-production co.nimblehq.ios.templates --bundle-id-staging co.nimblehq.ios.templates.staging --project-name TemplateApp --interface SwiftUI + + - name: Get release version + run: | + filename=$(find . -maxdepth 1 -name "*.xcodeproj" -exec basename {} .xcodeproj \; | head -n 1) + release_version=$(sed -n 's/.*MARKETING_VERSION *= *\([^;]*\);.*/\1/p' "$filename.xcodeproj/project.pbxproj" | head -n 1 | sed 's/^[^=]*=\s*//' | tr -d ' ') + echo $release_version + echo "RELEASE_VERSION=$release_version" >> "$GITHUB_ENV" + + - uses: nimblehq/github-actions-workflows/create_release_pull_request@0.1.10 + with: + release_version: ${{ env.RELEASE_VERSION }} + changelog_configuration: ".github/workflows/config/changelog-config.json" + assignee: bot-nimble + + # create_bump_version_pull_request: + # name: Create Bump Version Pull Request + # runs-on: macos-latest + # timeout-minutes: 30 + # permissions: + # contents: write + # pull-requests: write + # steps: + # - name: Validate Version Input + # run: | + # if ! [[ "${{ github.event.inputs.nextVersion }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + # echo "Error: nextVersion must follow semantic versioning (e.g., 1.2.3)" + # exit 1 + # fi + # - name: Create Bump Version branch + # uses: peterjgrainger/action-create-branch@v2.2.0 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # branch: chore/bump-version-to-${{ github.event.inputs.nextVersion }} + + # - name: Checkout code + # uses: actions/checkout@v4 + # with: + # ref: chore/bump-version-to-${{ github.event.inputs.nextVersion }} + + # - name: Bump version + # run: | + # filename=$(find . -maxdepth 1 -name "*.xcodeproj" -exec basename {} .xcodeproj \; | head -n 1) + # sed -i "" "s/MARKETING_VERSION = .*/MARKETING_VERSION = ${{ github.event.inputs.nextVersion }};/g" $filename.xcodeproj/project.pbxproj + + # - name: Set up Git + # run: | + # git config --global user.name 'Github Actions' + # git config --global user.email 'github-actions@users.noreply.github.com' + + # - name: Commit changes + # run: | + # git add . + # git commit -m "[Chore] Bump version to ${{ github.event.inputs.nextVersion }}" + # git push origin HEAD + + # - name: Create pull request + # run: | + # echo -e "## What happened ๐Ÿ‘€\n\nBump version to ${{ github.event.inputs.nextVersion }}" > body + # export body=$(cat body) ; gh pr create --draft -B develop -H chore/bump-version-to-${{ github.event.inputs.nextVersion }} -t '[Chore] Bump version to ${{ github.event.inputs.nextVersion }}' -b "$body" + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}