|
| 1 | +name: Integration Candidate Bundle Generation |
| 2 | + |
| 3 | +# Generate Integration Candidate branch for this repository. |
| 4 | + |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + pr_nums: |
| 9 | + description: 'The pull request numbers to include (Comma separated)' |
| 10 | + required: true |
| 11 | + type: string |
| 12 | + |
| 13 | +jobs: |
| 14 | + generate-ic-bundle: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Install Dependencies |
| 18 | + run: | |
| 19 | + sudo apt update |
| 20 | + sudo apt install -y w3m |
| 21 | + - name: Checkout IC Branch |
| 22 | + uses: actions/checkout@v3 |
| 23 | + with: |
| 24 | + fetch-depth: '0' |
| 25 | + ref: main |
| 26 | + - name: Rebase IC Branch |
| 27 | + run: | |
| 28 | + git config user.name "GitHub Actions" |
| 29 | + git config user.email "[email protected]" |
| 30 | + git pull |
| 31 | + git checkout integration-candidate |
| 32 | + git rebase main |
| 33 | + - name: Merge each PR |
| 34 | + env: |
| 35 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + run: | |
| 37 | + prs=$(echo ${{ inputs.pr_nums }} | tr "," "\n") |
| 38 | + for pr in $prs |
| 39 | + do |
| 40 | + src_branch=$(hub pr show -f %H $pr) |
| 41 | + pr_title=$(hub pr show -f %t $pr) |
| 42 | + commit_msg=$'Merge pull request #'"${pr}"$' from '"${src_branch}"$'\n\n'"${pr_title}" |
| 43 | + git fetch origin pull/$pr/head:origin/pull/$pr/head |
| 44 | + git merge origin/pull/$pr/head --no-ff -m "$commit_msg" |
| 45 | + done |
| 46 | + - name: Update Changelog and Version.h files |
| 47 | + env: |
| 48 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 49 | + run: | |
| 50 | + rev_num=$(git rev-list v6.0.0-rc4.. --count) |
| 51 | + changelog_entry=$'# Changelog\\n\\n## Development Build: v6.0.0-rc4+dev'${rev_num} |
| 52 | + prs=$(echo ${{ inputs.pr_nums }} | tr "," "\n") |
| 53 | + see_entry=$'\-\ See:' |
| 54 | + for pr in $prs |
| 55 | + do |
| 56 | + pr_title=$(hub pr show -f %t $pr) |
| 57 | + changelog_entry="${changelog_entry}"$'\\n- '"${pr_title@Q}" |
| 58 | + see_entry="${see_entry}"$' <https://github.com/nasa/cFE/pull/'${pr}$'>' |
| 59 | + done |
| 60 | + changelog_entry="${changelog_entry}\n${see_entry}\n" |
| 61 | + echo "s|# Changelog|$changelog_entry|" |
| 62 | + sed -ir "s|Changelog|$changelog_entry|" CHANGELOG.md |
| 63 | + |
| 64 | + buildnumber_entry=$'#define OS_BUILD_NUMBER '${rev_num} |
| 65 | + sed -ir "s|define OS_BUILD_NUMBER.*|$buildnumber_entry|" src/os/inc/osapi-version.h |
| 66 | + - name: Commit and Push Updates to IC Branch |
| 67 | + env: |
| 68 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 69 | + run: | |
| 70 | + rev_num=$(git rev-list v6.0.0-rc4.. --count) |
| 71 | + git add CHANGELOG.md |
| 72 | + git add src/os/inc/osapi-version.h |
| 73 | + git commit -m "Updating documentation and version numbers for v6.0.0-rc4+dev${rev_num}" |
| 74 | + git push -v origin integration-candidate |
0 commit comments