|
| 1 | +name: Create Release Pull Request |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + nextVersion: |
| 7 | + description: "Next version (eg. 1.0.0)x" |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - feature/557-automate-release-pull-request-creation-process |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +jobs: |
| 19 | + create_release_pull_request: |
| 20 | + name: Create Release Pull Request |
| 21 | + runs-on: macOS-latest |
| 22 | + timeout-minutes: 30 |
| 23 | + steps: |
| 24 | + - name: Checkout code |
| 25 | + uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: Install SSH key |
| 28 | + uses: webfactory/[email protected] |
| 29 | + with: |
| 30 | + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} |
| 31 | + |
| 32 | + - name: Install Firebase-Tools |
| 33 | + run: | |
| 34 | + yarn global add firebase-tools |
| 35 | + echo "$(yarn global bin)" >> $GITHUB_PATH |
| 36 | +
|
| 37 | + - name: Read Google Service Account |
| 38 | + id: firebase_service_account |
| 39 | + |
| 40 | + with: |
| 41 | + fileName: 'firebase_service_account.json' |
| 42 | + encodedString: ${{ secrets.FIREBASE_GOOGLE_APPLICATION_CREDENTIALS_BASE64 }} |
| 43 | + |
| 44 | + - name: Bundle install |
| 45 | + run: bundle install |
| 46 | + |
| 47 | + - name: Cache Pods |
| 48 | + uses: actions/cache@v3 |
| 49 | + id: cocoapodCache |
| 50 | + with: |
| 51 | + path: Pods |
| 52 | + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} |
| 53 | + restore-keys: | |
| 54 | + ${{ runner.os }}-pods- |
| 55 | +
|
| 56 | + - name: Start Install Script for Template App |
| 57 | + 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 UIKit |
| 58 | + - name: Find HEAD commit |
| 59 | + id: head |
| 60 | + run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT |
| 61 | + |
| 62 | + - name: Build changelog on "main" |
| 63 | + id: changelog |
| 64 | + uses: mikepenz/release-changelog-builder-action@v4 |
| 65 | + with: |
| 66 | + configuration: ".github/workflows/configs/changelog-config.json" |
| 67 | + # Listing PRs from the last tag to the HEAD commit |
| 68 | + toTag: ${{ steps.head.outputs.sha }} |
| 69 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + |
| 71 | + - name: Prepare variables |
| 72 | + run: | |
| 73 | + echo "RELEASE_VERSION=$(grep -oP 'MARKETING_VERSION\s*=\s*[^;]+' {PROJECT_NAME}.xcodeproj/project.pbxproj | head -n 1 | sed 's/^[^=]*=\s*//' | tr -d ' ')" >> $GITHUB_ENV |
| 74 | + echo "${{ steps.changelog.outputs.changelog }}" | sed 's/"/\\"/g' > escaped-changelog.txt |
| 75 | +
|
| 76 | + - name: Create Release branch |
| 77 | + uses: peterjgrainger/[email protected] |
| 78 | + env: |
| 79 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 80 | + with: |
| 81 | + branch: release/${{ env.RELEASE_VERSION }} |
| 82 | + |
| 83 | + - name: Create pull request |
| 84 | + run: gh pr create --draft -B main -H release/${{ env.RELEASE_VERSION }} -t 'Release - ${{ env.RELEASE_VERSION }}' -b "$(cat escaped-changelog.txt)" |
| 85 | + env: |
| 86 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 87 | + |
| 88 | + # create_bump_version_pull_request: |
| 89 | + # name: Create Bump Version Pull Request |
| 90 | + # runs-on: macos-latest |
| 91 | + # timeout-minutes: 30 |
| 92 | + # permissions: |
| 93 | + # contents: write |
| 94 | + # pull-requests: write |
| 95 | + # steps: |
| 96 | + # - name: Create Bump Version branch |
| 97 | + # uses: peterjgrainger/[email protected] |
| 98 | + # env: |
| 99 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 100 | + # with: |
| 101 | + # branch: chore/bump-version-to-1.1.0 |
| 102 | + |
| 103 | + # - name: Checkout code |
| 104 | + # uses: actions/checkout@v4 |
| 105 | + # with: |
| 106 | + # ref: chore/bump-version-to-1.1.0 |
| 107 | + |
| 108 | + # - name: Bump version |
| 109 | + # run: sed -i "" "s/MARKETING_VERSION = .*/MARKETING_VERSION = 1.1.0;/g" {PROJECT_NAME}.xcodeproj/project.pbxproj |
| 110 | + |
| 111 | + # - name: Set up Git |
| 112 | + # run: | |
| 113 | + # git config --global user.name 'Github Actions' |
| 114 | + # git config --global user.email '[email protected]' |
| 115 | + |
| 116 | + # - name: Commit changes |
| 117 | + # run: | |
| 118 | + # git add . |
| 119 | + # git commit -m "[Chore] Bump version to 1.1.0" |
| 120 | + # git push origin HEAD |
| 121 | + |
| 122 | + # - name: Create pull request |
| 123 | + # run: | |
| 124 | + # echo -e "## What happened 👀\n\nBump version to 1.1.0" > body |
| 125 | + # export body=$(cat body) ; gh pr create --draft -B develop -H chore/bump-version-to-1.1.0 -t '[Chore] Bump version to 1.1.0' -b "$body" |
| 126 | + # env: |
| 127 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments