diff --git a/.github/workflows/open-docs-pr.yml b/.github/workflows/open-docs-pr.yml new file mode 100644 index 000000000..29a9127a0 --- /dev/null +++ b/.github/workflows/open-docs-pr.yml @@ -0,0 +1,68 @@ +--- +name: Open a pull-request on the celo-org/docs repository + +on: + workflow_call: + inputs: + commit: + description: 'Commit of the developer-tooling repo that the submodule will be updated to' + type: string + required: true + + workflow_dispatch: + push: + branches: + - ci/update-celo-docs + +jobs: + open-docs-pr: + name: Prepare or Publish + # TODO: ask the correct runner for this workflow + runs-on: ['self-hosted', 'org', '8-cpu'] + # TODO: ask correct permissions + permissions: + contents: write + id-token: write + pull-requests: write + repository-projects: write + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Open pull-request + run: | + COMMIT=${{ inputs.commit }} + REPOSITORY="nicolasbrugneaux/celo-docs" + BRANCH_NAME="ci/${{ github.run_id }}-${{ github.run_attempt }}" + + # Clone the remote repository + git clone \ + --depth=1 \ + --branch=main \ + https://github.com/$REPOSITORY docs + + cd docs + + # Setup the committers identity. + # TODO: ask security for a bot account + git config user.email "nicolas.brugneaux@clabs.co" + git config user.name "Nicolas Brugneaux" + + # Create a new feature branch for the changes. + git checkout -b $BRANCH_NAME + + cd submodule/developer-tooling + git checkout $COMMIT + cd .. + + git add . + git commit -m "chore: update developer-tooling submodule" + git push origin $BRANCH_NAME + + echo "${{ secrets.ACCESS_TOKEN }}" > token.txt + gh auth login --with-token < token.txt + gh pr create \ + --body "__I was created by a bot beep boop__" \ + --title "chore: update developer-tooling submodule to $COMMIT" \ + --head "$BRANCH_NAME" \ + --base "main" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4b105db8b..8091d6a85 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,14 +18,15 @@ jobs: id-token: write pull-requests: write repository-projects: write + outputs: + publishedPackages: ${{ steps.changesets.outputs.publishedPackages }} steps: - name: Checkout Repo uses: actions/checkout@v4 - name: Akeyless Get Secrets id: get_auth_token - uses: - docker://us-west1-docker.pkg.dev/devopsre/akeyless-public/akeyless-action:latest + uses: docker://us-west1-docker.pkg.dev/devopsre/akeyless-public/akeyless-action:latest with: api-url: https://api.gateway.akeyless.celo-networks-dev.org access-id: p-kf9vjzruht6l @@ -34,8 +35,8 @@ jobs: uses: actions/setup-node@v4 with: node-version: 18.x - - name: "enable corepack for yarn" - run : sudo corepack enable yarn + - name: 'enable corepack for yarn' + run: sudo corepack enable yarn shell: bash # must call twice because of chicken and egg problem with yarn and node - uses: actions/setup-node@v4 @@ -54,4 +55,11 @@ jobs: with: # This expects you to have a script called release which does a build for your packages and calls changeset publish publish: yarn release - version: yarn version-and-reinstall \ No newline at end of file + version: yarn version-and-reinstall + + open-docs-pr: + needs: release + if: ${{ contains(fromJson(needs.release.outputs.publishedPackages).*.name, '@celo/cli') }} + uses: celo-org/developer-tooling/.github/workflows/open-docs-pr.yml@ci/update-celo-docs + with: + commit: ${{ github.ref_name }}