Skip to content

Commit

Permalink
create pr to charts repo #161
Browse files Browse the repository at this point in the history
  • Loading branch information
akyriako committed Nov 19, 2024
1 parent 9d2f40f commit 55664dd
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions .github/workflows/build-publish-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,29 +97,38 @@ jobs:
needs: [build-preview]
environment: preview
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Configure Git User as GitHub Actions Bot
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Checkout
- name: Create GitHub App Token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_KEY }}
- name: Checkout Charts Repo
uses: actions/checkout@v4
with:
repository: "${{ vars.DOCS_NEXT_CHARTS_ORG }}/${{ vars.DOCS_NEXT_CHARTS_REPO }}"
token: ${{ secrets.DOCS_NEXT_CHARTS_TOKEN }}

- name: Update Charts and Commit Changes
id: update_charts
token: ${{ steps.app-token.outputs.token }}
- name: Commit Changes
env:
image: ${{ vars.REGISTRY }}/${{ vars.REGISTRY_ORG }}/${{ vars.IMG_NAME }}
tag: ${{ needs.build-preview.outputs.image_version }}
run: |
# docusaurus
sed -i 's/^tag: .*/tag: ${{ env.tag }}/' ./charts/docusaurus/values-stg.yaml
sed -i 's/^image: .*/image: ${{ env.image }}/' ./charts/docusaurus/values-stg.yaml
# commit and push
git commit -am "Automatic commit from GitHub Actions triggered by action #${{github.run_number}}"
git remote set-url origin https://${{ secrets.DOCS_NEXT_CHARTS_TOKEN }}@github.com/${{ vars.DOCS_NEXT_CHARTS_ORG }}/${{ vars.DOCS_NEXT_CHARTS_REPO }}.git
git push origin main
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
sed -i 's/^tag: .*/tag: ${{ env.tag }}/' ./charts/docusaurus/values-stg.yaml
sed -i 's/^image: .*/image: ${{ env.image }}/' ./charts/docusaurus/values-stg.yaml
git commit -am "Automatic commit from GitHub Actions triggered by action #${{github.run_number}}"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
env:
remote_pr_branch: 'release/staging-${{ needs.build-preview.outputs.image_version }}'
with:
title: ${{ env.remote_pr_branch }}
token: ${{ steps.app-token.outputs.token }}
branch: ${{ env.remote_pr_branch }}

0 comments on commit 55664dd

Please sign in to comment.