add share price and dividend model support #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build, Version and Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: # Allow manual triggering of the workflow | |
| # Add permissions block to allow the workflow to write to the repository | |
| permissions: | |
| contents: write # This allows the GITHUB_TOKEN to push changes | |
| pull-requests: write | |
| deployments: write | |
| jobs: | |
| build_and_version: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # This gets all history for all branches and tags | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npm test | |
| # Run the version manager to increment build number | |
| - name: Increment build number | |
| run: node scripts/versioning/version-manager.js increment-build | |
| # Generate version file | |
| - name: Generate version file | |
| run: node scripts/versioning/version-manager.js generate-version-file | |
| # Build after version is updated | |
| - name: Build | |
| run: npm run build | |
| # Configure Git for committing version changes | |
| - name: Configure Git | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| # Commit version changes | |
| - name: Commit version changes | |
| run: | | |
| BUILD_NUMBER=$(cat buildNumber.txt) | |
| VERSION=$(node -p "require('./package.json').version") | |
| git add buildNumber.txt src/buildInfo.json | |
| # Only commit if there are changes | |
| if git diff --staged --quiet; then | |
| echo "No version changes to commit" | |
| else | |
| git commit -m "🤖 Auto-increment build number to $BUILD_NUMBER [skip ci]" | |
| # The GITHUB_TOKEN will be used automatically with the configured permissions | |
| git push | |
| fi | |
| - name: Archive production artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build | |
| path: dist | |
| # Deploy to Azure Static Web Apps if on main branch and not a PR | |
| deploy_to_azure: | |
| needs: build_and_version | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| name: Deploy to Azure | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| lfs: false | |
| ref: main # Ensure we have the latest including version bump | |
| # Download built artifact to deploy | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build | |
| path: dist | |
| - name: Deploy to Azure | |
| id: builddeploy | |
| uses: Azure/static-web-apps-deploy@v1 | |
| with: | |
| azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_VICTORIOUS_SKY_0FA984610 }} | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| action: "upload" | |
| app_location: "/" | |
| api_location: "" | |
| output_location: "dist" |