Skip to content

Commit

Permalink
ci: use livecodes-ci github app in other workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
zyf722 committed Nov 1, 2024
1 parent 94a47e1 commit a80f535
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@ jobs:
env:
NODE_OPTIONS: '--max_old_space_size=4096'
steps:
- name: Generate Github Token for CI Bot
uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.CI_APP_ID }}
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }}

- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_ACTIONS_REPO_PAT }}
token: ${{ steps.generate-token.outputs.token }}

- name: Use Node.js
uses: actions/setup-node@v4
Expand All @@ -33,6 +40,6 @@ jobs:
- name: Deploy
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${{github.repository}}.git
npm run deploy -- -u "github-actions-bot <support+actions@github.com>"
npm run deploy -- -u "livecodes-ci[bot] <186997172+livecodes-ci[bot]@users.noreply.github.com>"
env:
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_REPO_PAT }}
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
11 changes: 9 additions & 2 deletions .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ jobs:
runs-on: ubuntu-latest
if: contains(github.ref, 'refs/heads/releases/')
steps:
- name: Generate Github Token for CI Bot
uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.CI_APP_ID }}
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }}

- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_ACTIONS_REPO_PAT }}
token: ${{ steps.generate-token.outputs.token }}

- name: Get version
id: vars
Expand All @@ -19,4 +26,4 @@ jobs:
- name: Create pull request to develop
run: gh pr create --title "Prepare release ${{steps.vars.outputs.version}}" --body "Prepare release ${{steps.vars.outputs.version}}" --base develop --head "${{github.ref_name}}"
env:
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_REPO_PAT }}
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
15 changes: 11 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,17 @@ jobs:
env:
NODE_OPTIONS: '--max_old_space_size=4096'
steps:
- name: Generate Github Token for CI Bot
uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.CI_APP_ID }}
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }}

- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_ACTIONS_REPO_PAT }}
token: ${{ steps.generate-token.outputs.token }}

- name: Get version
id: vars
Expand Down Expand Up @@ -64,7 +71,7 @@ jobs:
files: |
livecodes-${{steps.vars.outputs.version}}.tar.gz
livecodes-${{steps.vars.outputs.version}}.zip
token: ${{ secrets.GH_ACTIONS_REPO_PAT }}
token: ${{ steps.generate-token.outputs.token }}

- name: Create permanent URL
if: startsWith(github.head_ref, 'releases/v')
Expand All @@ -88,10 +95,10 @@ jobs:
if: startsWith(github.head_ref, 'releases/v')
run: gh pr create --title "release ${{steps.vars.outputs.version}}" --body "https://${{steps.vars.outputs.version}}.livecodes.io" --base main --head develop
env:
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_REPO_PAT }}
GITHUB_token: ${{ steps.generate-token.outputs.token }}

- name: Create pull request to main (SDK)
if: startsWith(github.head_ref, 'releases/sdk-v')
run: gh pr create --title "release ${{steps.vars.outputs.version}}" --body "https://www.npmjs.com/package/livecodes" --base main --head develop
env:
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_REPO_PAT }}
GITHUB_token: ${{ steps.generate-token.outputs.token }}

0 comments on commit a80f535

Please sign in to comment.