Update website with latest charts and docs #203
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: "TrueCharts: Build-and-Release" | |
| concurrency: | |
| group: ${{ github.head_ref || github.ref }}-truecharts-release | |
| on: | |
| workflow_call: | |
| workflow_dispatch: | |
| pull_request: | |
| paths: | |
| - "truecharts/**" | |
| - "shared/**" | |
| - "package.json" | |
| - "package-lock.json" | |
| - "tsconfig.json" | |
| - "truecharts/wrangler.jsonc" | |
| - ".github/workflows/truecharts.yaml" | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "truecharts/**" | |
| - "shared/**" | |
| - "package.json" | |
| - "package-lock.json" | |
| - "tsconfig.json" | |
| - "truecharts/wrangler.jsonc" | |
| - ".github/workflows/truecharts.yaml" | |
| # Use `bash --noprofile --norc -exo pipefail` by default for all `run` steps in this workflow: | |
| # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaultsrun | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| release-truecharts: | |
| permissions: | |
| pull-requests: write | |
| name: "${{ github.ref == 'refs/heads/main' && '(Production)' || '(Preview)' }}" | |
| runs-on: | |
| group: default | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| fetch-depth: 1 | |
| - name: Comment deploy start | |
| if: github.event_name != 'push' | |
| continue-on-error: true | |
| uses: mshick/add-pr-comment@64b8e914979889d746c99dea15a76e77ef64580a # v3 | |
| with: | |
| message-id: truecharts-deploy | |
| message: | | |
| ### π§ TrueCharts Deploy Preview building... | |
| | Name | Link | | |
| |---------------------|-------------------------------------------------------------------------------| | |
| |π¨ Latest commit | ${{ github.sha }} | | |
| |π Latest deploy log | https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | | |
| --- | |
| - name: Setup Node | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 | |
| with: | |
| node-version-file: ./.nvmrc | |
| - name: Fix Package-Lock | |
| run: npm i --package-lock-only | |
| - name: Setup astro Cache | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 | |
| with: | |
| key: astro-truecharts-${{ hashFiles('package-lock.json') }} | |
| path: ./.astro | |
| restore-keys: astro-truecharts- | |
| - name: Setup npm Cache | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 | |
| with: | |
| path: ~/.npm | |
| key: npm-${{ hashFiles('package-lock.json') }} | |
| restore-keys: npm- | |
| - name: Setup node_modules Cache | |
| id: modulescache | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 | |
| with: | |
| path: ./node_modules | |
| key: modules-${{ hashFiles('package-lock.json') }} | |
| - name: Install Packages | |
| if: steps.modulescache.outputs.cache-hit != 'true' | |
| run: npm ci | |
| - name: Check | |
| run: npm run check:truecharts | |
| - name: Build | |
| env: | |
| NODE_OPTIONS: "--max-old-space-size=4096" | |
| run: npm run build:truecharts | |
| - name: Publish to Cloudflare Workers | |
| id: cloudflare | |
| continue-on-error: true | |
| env: | |
| CLOUDFLARE_ACCOUNT_ID: "${{ secrets.CLOUDFLARE_ACCOUNT_ID }}" | |
| CLOUDFLARE_API_TOKEN: "${{ secrets.CF_API_TOKEN }}" | |
| shell: bash | |
| run: | | |
| environment="" | |
| url="" | |
| echo "Git Ref: ${{ github.ref }}" | |
| if [ '${{ github.ref }}' == 'refs/heads/main' ]; then | |
| echo "Publishing TrueCharts to PRODUCTION environment" | |
| node_modules/wrangler/bin/wrangler.js deploy --config truecharts/wrangler.jsonc | |
| environment="production" | |
| url="https://truecharts.org" | |
| else | |
| echo "Publishing TrueCharts to PREVIEW environment" | |
| node_modules/wrangler/bin/wrangler.js versions upload --config truecharts/wrangler.jsonc | tee upload-output.txt | |
| environment="preview" | |
| url=$(grep 'Version Preview URL: ' upload-output.txt | awk '{print $NF}') | |
| fi | |
| echo "environment=$environment" >> $GITHUB_OUTPUT | |
| echo "url=$url" >> $GITHUB_OUTPUT | |
| - name: Comment deploy url | |
| if: github.event_name != 'push' | |
| continue-on-error: true | |
| uses: mshick/add-pr-comment@64b8e914979889d746c99dea15a76e77ef64580a # v3 | |
| with: | |
| message-id: truecharts-deploy | |
| message: | | |
| ### β TrueCharts Deploy Preview ready! | |
| | Name | Link | | |
| |----------------------|-------------------------------------------------------------------------------| | |
| |π¨ Latest commit | ${{ github.sha }} | | |
| |π Latest deploy log | https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | | |
| |π Deploy Preview Url | [${{ steps.cloudflare.outputs.url }}](${{ steps.cloudflare.outputs.url }}) | | |
| |π³ Environment | ${{ steps.cloudflare.outputs.environment }} | | |
| --- | |
| - name: TrueCharts Deploy Completed | |
| run: echo "DONE" |