Skip to content

Commit

Permalink
ci(ci/cd): Change CI Token Logic
Browse files Browse the repository at this point in the history
  • Loading branch information
yacosta738 committed Dec 28, 2023
1 parent c58765a commit f080f55
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/deploy-main-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ env:
VERSION: ${{ github.sha }}
CI: CI
NATIVE_IMAGE_ENABLED: enabled
CI_GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}

permissions:
packages: write
Expand All @@ -24,6 +25,12 @@ jobs:
contents: read
security-events: write
steps:
- name: 🔍 CI_GITHUB_TOKEN
if: env.CI_GITHUB_TOKEN == ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: echo "CI_GITHUB_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV

- name: Checkout source code
uses: actions/checkout@v4

Expand Down Expand Up @@ -89,7 +96,7 @@ jobs:
uses: trstringer/manual-approval@v1
timeout-minutes: 60
with:
secret: ${{ secrets.GITHUB_TOKEN }}
secret: ${{ env.CI_GITHUB_TOKEN }}
minimum-approvals: 1
approvers: ${{ github.repository_owner }}
issue-title: '🚀 Deploying ${{ steps.get_data.outputs.version }} to production'
Expand All @@ -106,7 +113,7 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v4
with:
token: ${{ secrets.CI_GITHUB_TOKEN }}
token: ${{ env.CI_GITHUB_TOKEN }}

- name: Set up JDK
uses: actions/setup-java@v4
Expand Down Expand Up @@ -169,7 +176,7 @@ jobs:
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
password: ${{ env.CI_GITHUB_TOKEN }}
- name: Publish container image
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
- name: Publish container image (latest)
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/dev-commit-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
VERSION: ${{ github.sha }}
CI: CI
NATIVE_IMAGE_ENABLED: enabled
CI_GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}

permissions:
packages: write
Expand All @@ -26,6 +27,12 @@ jobs:
contents: read
security-events: write
steps:
- name: 🔍 CI_GITHUB_TOKEN
if: env.CI_GITHUB_TOKEN == ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: echo "CI_GITHUB_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV

- name: Checkout source code
uses: actions/checkout@v4

Expand Down Expand Up @@ -97,7 +104,7 @@ jobs:
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
password: ${{ env.CI_GITHUB_TOKEN }}
- name: Publish container image
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
- name: Publish container image (latest)
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/pre-release-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ env:
VERSION: ${{ github.sha }}
CI: CI
NATIVE_IMAGE_ENABLED: enabled
CI_GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}

permissions:
packages: write
Expand All @@ -24,6 +25,12 @@ jobs:
contents: read
security-events: write
steps:
- name: 🔍 CI_GITHUB_TOKEN
if: env.CI_GITHUB_TOKEN == ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: echo "CI_GITHUB_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV

- name: Checkout source code
uses: actions/checkout@v4

Expand Down Expand Up @@ -83,7 +90,7 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v4
with:
token: ${{ secrets.CI_GITHUB_TOKEN }}
token: ${{ env.CI_GITHUB_TOKEN }}

- name: Set up JDK
uses: actions/setup-java@v4
Expand All @@ -105,4 +112,4 @@ jobs:
npm ci
npx semantic-release
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
GITHUB_TOKEN: ${{ env.CI_GITHUB_TOKEN }}
17 changes: 0 additions & 17 deletions .github/workflows/renovate.json

This file was deleted.

0 comments on commit f080f55

Please sign in to comment.