Skip to content

fix

fix #2

Workflow file for this run

# name: Example Build Number Usage
# on:
# push:
# branches: [main, staging, develop]
# pull_request:
# branches: [main]
# jobs:
# build:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# - name: Determine environment and build settings
# id: env
# run: |
# if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
# echo "env_id=production" >> $GITHUB_OUTPUT
# echo "initial=100" >> $GITHUB_OUTPUT
# echo "environment=production" >> $GITHUB_OUTPUT
# elif [[ "${{ github.ref }}" == "refs/heads/staging" ]]; then
# echo "env_id=staging-branch" >> $GITHUB_OUTPUT
# echo "initial=20" >> $GITHUB_OUTPUT
# echo "environment=staging" >> $GITHUB_OUTPUT
# else
# echo "env_id=development" >> $GITHUB_OUTPUT
# echo "initial=1" >> $GITHUB_OUTPUT
# echo "environment=development" >> $GITHUB_OUTPUT
# fi
# - name: Get Build Number
# id: build_number
# uses: ./
# with:
# id: ${{ steps.env.outputs.env_id }}
# initial_number: ${{ steps.env.outputs.initial }}
# gh_repo: ${{ github.repository }}
# github_token: ${{ secrets.GITHUB_TOKEN }}
# - name: Display Build Information
# run: |
# echo "🏗️ Build Information"
# echo "Environment: ${{ steps.env.outputs.environment }}"
# echo "Build Number: ${{ steps.build_number.outputs.build_number }}"
# echo "Previous Number: ${{ steps.build_number.outputs.previous_number }}"
# echo "Branch: ${{ github.ref_name }}"
# echo "Commit: ${{ github.sha }}"
# - name: Simulate Build Process
# run: |
# echo "🔨 Building application with build number ${{ steps.build_number.outputs.build_number }}"
# echo "This is where your actual build commands would go"
# echo "For example:"
# echo " - npm install && npm run build"
# echo " - docker build -t myapp:${{ steps.build_number.outputs.build_number }} ."
# echo " - kubectl set image deployment/myapp myapp=myapp:${{ steps.build_number.outputs.build_number }}"
# - name: Create Build Artifact
# run: |
# mkdir -p build-artifacts
# echo "Build Number: ${{ steps.build_number.outputs.build_number }}" > build-artifacts/build-info.txt
# echo "Environment: ${{ steps.env.outputs.environment }}" >> build-artifacts/build-info.txt
# echo "Commit: ${{ github.sha }}" >> build-artifacts/build-info.txt
# echo "Branch: ${{ github.ref_name }}" >> build-artifacts/build-info.txt
# echo "Timestamp: $(date -u)" >> build-artifacts/build-info.txt
# - name: Upload Build Artifacts
# uses: actions/upload-artifact@v4
# with:
# name: build-info-${{ steps.env.outputs.environment }}-${{ steps.build_number.outputs.build_number }}
# path: build-artifacts/