|
| 1 | +# This workflow uses actions that are not certified by GitHub. |
| 2 | +# They are provided by a third-party and are governed by |
| 3 | +# separate terms of service, privacy policy, and support |
| 4 | +# documentation. |
| 5 | +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time |
| 6 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle |
| 7 | + |
| 8 | +name: CI Build on Stable Branch and Push to Cloud Repository |
| 9 | + |
| 10 | +on: |
| 11 | + push: |
| 12 | + branches: [ "stable" ] |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: write |
| 16 | + |
| 17 | +jobs: |
| 18 | + pushToCloudRepository: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout external repo |
| 23 | + uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + repository: bytechefhq/bytechef-cloud |
| 26 | + token: ${{ secrets.PRIVATE_REPOSITORY_GIT_API_TOKEN }} # PAT with 'repo' scope |
| 27 | + path: bytechef-merge |
| 28 | + - name: Investigate private repository checkout results |
| 29 | + env: |
| 30 | + ENV_BRANCH_NAME: stable-env-branch-name |
| 31 | + run: | |
| 32 | + pwd |
| 33 | + ls -la bytechef-merge |
| 34 | + cd bytechef-merge |
| 35 | + git branch |
| 36 | + git remote show |
| 37 | + git remote rename origin origin-cloud |
| 38 | + echo "Remote renamed" |
| 39 | + git remote show |
| 40 | + git remote add origin-public [email protected]:bytechefhq/bytechef.git |
| 41 | + echo "New Remote Added" |
| 42 | + git remote show |
| 43 | + echo "Setup authorization" |
| 44 | + /usr/bin/git config --local --name-only --get-regexp core\.sshCommand |
| 45 | + echo "Setup authorization - STEP 1" |
| 46 | + /usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :" |
| 47 | + echo "Setup authorization - STEP 2" |
| 48 | + /usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader |
| 49 | + echo "Setup authorization - STEP 3" |
| 50 | + /usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :" |
| 51 | + echo "Setup authorization - STEP 4" |
| 52 | + /usr/bin/git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ${{ secrets.PRIVATE_REPOSITORY_GIT_API_TOKEN }} |
| 53 | + echo "Fetch public ${ENV_BRANCH_NAME}" |
| 54 | + git fetch origin-public stable |
| 55 | + git checkout -b stable-public origin-public/stable |
| 56 | + echo "New Branch Added" |
| 57 | + git branch |
| 58 | + git remote show |
| 59 | + - name: Remove last commit |
| 60 | + run: | |
| 61 | + pwd |
| 62 | + cd bytechef-merge |
| 63 | + ls -la |
| 64 | + git remote show |
| 65 | + git reset --hard HEAD~1 |
| 66 | + git remote show |
| 67 | + echo "Done with git preparation" |
| 68 | + - name: Push to private repository |
| 69 | + run: | |
| 70 | + pwd |
| 71 | + ls -la |
| 72 | + cd bytechef-merge |
| 73 | + git remote show |
| 74 | + git push -f origin-cloud stable-public:stable |
| 75 | +
|
0 commit comments