Skip to content

Commit bcacc28

Browse files
committed
feat(gh-actions): 🚀 Tentative change generate token as composite
1 parent bde5240 commit bcacc28

File tree

4 files changed

+24
-48
lines changed

4 files changed

+24
-48
lines changed

.github/actions/generate-token.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 'Generate GitHub App Token'
2+
description: 'Generates a GitHub App token'
3+
outputs:
4+
token:
5+
description: 'Generated GitHub App Token'
6+
value: ${{ steps.generate-zdc-token.outputs.token }}
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Generate GitHub App Token
12+
uses: actions/create-github-app-token@v1
13+
id: generate-zdc-token
14+
with:
15+
app-id: ${{ vars.ZDC_AUTH_APP_ID }}
16+
private-key: ${{ secrets.ZDC_AUTH_PRIVATE_KEY }}
17+
owner: ${{ github.repository_owner }}

.github/workflows/deploy-chatbot.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,21 @@ jobs:
3232
echo "Project: ${{ steps.parse-deploy-command.outputs.project }}"
3333
echo "Infra: ${{ steps.parse-deploy-command.outputs.infra }}"
3434
35-
generate-token:
36-
needs: parse-command
37-
uses: zerodaycode/app-summoners-sync/.github/workflows/generate-token.yml@develop
38-
secrets: inherit
39-
4035
notify-user:
41-
needs: [parse-command, generate-token]
36+
needs: [parse-command]
4237
uses: zerodaycode/app-summoners-sync/.github/workflows/notify-user.yml@develop
4338
with:
4439
environment: ${{ needs.parse-command.outputs.environment }}
4540
project: ${{ needs.parse-command.outputs.project }}
4641
infra: ${{ needs.parse-command.outputs.artifact }}
4742

4843
deploy-project:
49-
needs: [parse-command, generate-token, notify-user]
44+
needs: [parse-command, notify-user]
5045
if: needs.parse-command.outputs.project != ''
5146
uses: zerodaycode/app-summoners-sync/.github/workflows/deploy-project.yml@develop
5247
with:
5348
project: ${{ needs.parse-command.outputs.project }}
5449
environment: ${{ needs.parse-command.outputs.environment }}
55-
secrets:
56-
ZDC_TOKEN: ${{ needs.generate-token.outputs.ZDC_TOKEN }}
57-
PASSPHRASE_ACTION_TOKEN: ${{ secrets.PASSPHRASE_ACTION_TOKEN }}
5850

5951
deploy-infra:
6052
needs: [parse-command, notify-user]

.github/workflows/deploy-project.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,20 @@ on:
99
environment:
1010
required: true
1111
type: string
12-
secrets:
13-
ZDC_TOKEN:
14-
required: true
15-
PASSPHRASE_ACTION_TOKEN:
16-
required: true
12+
1713

1814
jobs:
1915
deploy_project_artifact:
2016
runs-on: ubuntu-latest
2117
steps:
22-
- name: Decrypt ZDC Token
23-
id: decrypt-token
24-
run: |
25-
ENCRYPTED_TOKEN="${{ secrets.ZDC_TOKEN }}"
26-
DECRYPTED_TOKEN=$(echo "$ENCRYPTED_TOKEN" | base64 -d | gpg --decrypt --quiet --batch --passphrase "${{ secrets.PASSPHRASE_ACTION_TOKEN }}")
27-
echo "ZDCTOKEN=$DECRYPTED_TOKEN" >> $GITHUB_ENV
28-
echo "::add-mask::$DECRYPTED_TOKEN"
18+
- name: Generate Token
19+
id: generate-token
20+
uses: zerodaycode/app-summoners-sync/.github/actions/generate-token.yml@develop
2921

3022
- name: Trigger Deployment Workflow
3123
uses: actions/github-script@v7
3224
with:
33-
github-token: ${{ env.ZDCTOKEN }}
25+
github-token: ${{ steps.generate-token.outputs.token }}
3426
script: |
3527
const environment = `"${{ inputs.environment }}"`;
3628
const project = `"${{ inputs.project }}"`;

.github/workflows/generate-token.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)