Skip to content

Commit

Permalink
feat(ci): migrate to github apps (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
KeisukeYamashita authored May 30, 2024
1 parent 1c02ac9 commit b2d7f96
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 10 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@ jobs:
# ARTIFACTS_SERVER: server/dist #TODO: fix here
ARTIFACTS_WEB: reearth-marketplace-web_${{ needs.info.outputs.name }}.tar.gz
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: get latest web artifact
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.GPT }}
github_token: ${{ steps.app-token.outputs.token }}
workflow: ci.yml
workflow_conclusion: success
branch: ${{ github.event.workflow_run.head_branch }}
Expand Down Expand Up @@ -112,6 +117,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand Down Expand Up @@ -148,7 +158,7 @@ jobs:
- name: Download web arfiacts
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.GPT }}
github_token: ${{ steps.app-token.outputs.token }}
workflow: ci.yml
workflow_conclusion: success
branch: ${{ github.event.workflow_run.head_branch }}
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ jobs:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion != 'failure' && github.event.repository.full_name == 'reearth/reearth-marketplace' && github.event.workflow_run.head_branch == 'main'
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: get latest web artifact
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.GPT }}
github_token: ${{ steps.app-token.outputs.token }}
workflow: ci.yml
workflow_conclusion: success
branch: main
Expand All @@ -42,6 +47,11 @@ jobs:
id-token: write
packages: read
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
Expand All @@ -55,7 +65,7 @@ jobs:
- name: Download server arfiacts
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.GPT }}
github_token: ${{ steps.app-token.outputs.token }}
workflow: build.yml
workflow_conclusion: success
branch: main
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,22 @@ jobs:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/release'
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: git config
env:
GPT_USER: ${{ secrets.GPT_USER }}
GH_APP_USER: ${{ vars.GH_APP_USER }}
run: |
git config --global user.name $GPT_USER
git config --global user.name $GH_APP_USER
git config --global pull.rebase false
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GPT }}
token: ${{ steps.app-token.outputs.token }}
- id: changelog
name: Generate CHANGELOG
uses: reearth/changelog-action@main
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ jobs:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: git config
env:
GPT_USER: ${{ secrets.GPT_USER }}
GH_APP_USER: ${{ vars.GH_APP_USER }}
run: |
git config --global user.name $GPT_USER
git config --global user.name $GH_APP_USER
git config --global pull.rebase false
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GPT }}
token: ${{ steps.app-token.outputs.token }}
- name: Checkout release branch
run: git switch release || git switch -c release
- name: Merge main branch to release branch
Expand Down

0 comments on commit b2d7f96

Please sign in to comment.