mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-19 10:07:46 -05:00
feat(GHA): configurable SHOW_UPCOMING_CHANGES (#63395)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
2d65f11e0f
commit
982d0fb290
16
.github/workflows/deploy-api.yml
vendored
16
.github/workflows/deploy-api.yml
vendored
@@ -11,6 +11,10 @@ on:
|
||||
- info
|
||||
- warn
|
||||
default: info
|
||||
show_upcoming_changes:
|
||||
description: 'Show upcoming changes (enables upcoming certifications and challenges)'
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
setup-jobs:
|
||||
@@ -21,12 +25,21 @@ jobs:
|
||||
tgt_env_short: ${{ steps.setup.outputs.tgt_env_short }}
|
||||
tgt_env_long: ${{ steps.setup.outputs.tgt_env_long }}
|
||||
api_log_lvl: ${{ steps.setup.outputs.api_log_lvl }}
|
||||
show_upcoming_changes: ${{ steps.setup.outputs.show_upcoming_changes }}
|
||||
steps:
|
||||
- name: Setup
|
||||
id: setup
|
||||
run: |
|
||||
BRANCH="${{ github.ref_name }}"
|
||||
echo "Current branch: $BRANCH"
|
||||
|
||||
# Convert boolean input to string 'true' or 'false'
|
||||
if [[ "${{ inputs.show_upcoming_changes }}" == "true" ]]; then
|
||||
echo "show_upcoming_changes=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "show_upcoming_changes=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
case "$BRANCH" in
|
||||
"prod-current")
|
||||
echo "site_tld=org" >> $GITHUB_OUTPUT
|
||||
@@ -49,6 +62,7 @@ jobs:
|
||||
with:
|
||||
site_tld: ${{ needs.setup-jobs.outputs.site_tld }}
|
||||
app: api
|
||||
show_upcoming_changes: ${{ needs.setup-jobs.outputs.show_upcoming_changes }}
|
||||
secrets: inherit
|
||||
|
||||
deploy:
|
||||
@@ -168,6 +182,7 @@ jobs:
|
||||
DEPLOYMENT_ENV: ${{ needs.setup-jobs.outputs.tgt_env_long }}
|
||||
DEPLOYMENT_TLD: ${{ needs.setup-jobs.outputs.site_tld }}
|
||||
FCC_API_LOG_LEVEL: ${{ needs.setup-jobs.outputs.api_log_lvl }}
|
||||
SHOW_UPCOMING_CHANGES: ${{ needs.setup-jobs.outputs.show_upcoming_changes }}
|
||||
# Stack name
|
||||
STACK_NAME: ${{ needs.setup-jobs.outputs.tgt_env_short }}-api
|
||||
run: |
|
||||
@@ -205,6 +220,7 @@ jobs:
|
||||
echo \"DEPLOYMENT_TLD=$DEPLOYMENT_TLD\"
|
||||
echo \"DEPLOYMENT_ENV=$DEPLOYMENT_ENV\"
|
||||
echo \"FCC_API_LOG_LEVEL=$FCC_API_LOG_LEVEL\"
|
||||
echo \"SHOW_UPCOMING_CHANGES=$SHOW_UPCOMING_CHANGES\"
|
||||
} >> .env
|
||||
|
||||
echo -e '\nLOG:Sourcing environment...'
|
||||
|
||||
15
.github/workflows/deploy-client.yml
vendored
15
.github/workflows/deploy-client.yml
vendored
@@ -19,6 +19,10 @@ on:
|
||||
- german
|
||||
- swahili
|
||||
default: all
|
||||
show_upcoming_changes:
|
||||
description: 'Show upcoming changes (enables upcoming certifications and challenges)'
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
setup-jobs:
|
||||
@@ -29,12 +33,21 @@ jobs:
|
||||
tgt_env_short: ${{ steps.setup.outputs.tgt_env_short }} # prd, stg
|
||||
tgt_env_long: ${{ steps.setup.outputs.tgt_env_long }} # production, staging
|
||||
tgt_env_branch: ${{ steps.setup.outputs.tgt_env_branch }} # prod-current, prod-staging
|
||||
show_upcoming_changes: ${{ steps.setup.outputs.show_upcoming_changes }}
|
||||
steps:
|
||||
- name: Setup
|
||||
id: setup
|
||||
run: |
|
||||
BRANCH="${{ github.ref_name }}"
|
||||
echo "Current branch: $BRANCH"
|
||||
|
||||
# Convert boolean input to string 'true' or 'false'
|
||||
if [[ "${{ inputs.show_upcoming_changes }}" == "true" ]]; then
|
||||
echo "show_upcoming_changes=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "show_upcoming_changes=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
case "$BRANCH" in
|
||||
"prod-current")
|
||||
echo "site_tld=org" >> $GITHUB_OUTPUT
|
||||
@@ -195,7 +208,7 @@ jobs:
|
||||
PATREON_CLIENT_ID: ${{ secrets.PATREON_CLIENT_ID }}
|
||||
PAYPAL_CLIENT_ID: ${{ secrets.PAYPAL_CLIENT_ID }}
|
||||
STRIPE_PUBLIC_KEY: ${{ secrets.STRIPE_PUBLIC_KEY }}
|
||||
SHOW_UPCOMING_CHANGES: ${{ vars.SHOW_UPCOMING_CHANGES || 'false' }}
|
||||
SHOW_UPCOMING_CHANGES: ${{ needs.setup-jobs.outputs.show_upcoming_changes }}
|
||||
FREECODECAMP_NODE_ENV: production
|
||||
# The below is used in ecosystem.config.js file for the API -- to be removed later
|
||||
DEPLOYMENT_ENV: ${{ needs.setup-jobs.outputs.tgt_env_long }}
|
||||
|
||||
11
.github/workflows/docker-docr.yml
vendored
11
.github/workflows/docker-docr.yml
vendored
@@ -16,6 +16,11 @@ on:
|
||||
type: string
|
||||
description: 'Input: The app (component) to build'
|
||||
default: 'api'
|
||||
show_upcoming_changes:
|
||||
required: false
|
||||
type: string
|
||||
description: 'Input: Show upcoming changes flag (true/false)'
|
||||
default: 'false'
|
||||
workflow_call:
|
||||
inputs:
|
||||
site_tld:
|
||||
@@ -26,6 +31,11 @@ on:
|
||||
required: true
|
||||
type: string
|
||||
description: 'Input: The app (component) to build'
|
||||
show_upcoming_changes:
|
||||
required: false
|
||||
type: string
|
||||
description: 'Input: Show upcoming changes flag (true/false)'
|
||||
default: 'false'
|
||||
outputs:
|
||||
tagname:
|
||||
description: 'Output: The tagname for the image built'
|
||||
@@ -54,6 +64,7 @@ jobs:
|
||||
- name: Build & Tag Image
|
||||
run: |
|
||||
docker build \
|
||||
--build-arg SHOW_UPCOMING_CHANGES=${{ inputs.show_upcoming_changes }} \
|
||||
--tag registry.digitalocean.com/${{ secrets.DOCR_NAME }}/${{ inputs.site_tld }}/learn-${{ inputs.app }}:$tagname \
|
||||
--tag registry.digitalocean.com/${{ secrets.DOCR_NAME }}/${{ inputs.site_tld }}/learn-${{ inputs.app }}:latest \
|
||||
--file docker/${{ inputs.app }}/Dockerfile .
|
||||
|
||||
@@ -25,10 +25,12 @@ ARG STRIPE_PUBLIC_KEY
|
||||
ARG PAYPAL_CLIENT_ID
|
||||
ARG PATREON_CLIENT_ID
|
||||
ARG DEPLOYMENT_ENV
|
||||
ARG SHOW_UPCOMING_CHANGES
|
||||
ARG SHOW_UPCOMING_CHANGES=false
|
||||
ARG GROWTHBOOK_URI
|
||||
ARG FREECODECAMP_NODE_ENV
|
||||
|
||||
ENV SHOW_UPCOMING_CHANGES=$SHOW_UPCOMING_CHANGES
|
||||
|
||||
# For simplicity and because node_modules do not make it into the final image,
|
||||
# we can just install all dependencies here.
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
Reference in New Issue
Block a user