improved visual on blog #170
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: Deploy tkokhing main page to GitHub Pages | |
| on: | |
| push: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout full branches | |
| uses: actions/checkout@v4 | |
| - name: Checkout [heptagoning] private repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: tkokhing/heptagoning | |
| token: ${{ secrets.PULL_HEPTAGONING_TOKEN }} | |
| path: temp_heptagoning | |
| - name: Move [_kill-chain] folder inside _heptagoning to correct level | |
| id: move_heptagoning_kill-chain | |
| run: | | |
| mkdir -p _heptagoning/_kill-chain | |
| mv ./temp_heptagoning/* ./_heptagoning | |
| rm -rf ./temp_heptagoning | |
| - name: Checkout [tkokhing_lib] private repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: tkokhing/tkokhing_lib | |
| token: ${{ secrets.PULL_LIB_TOKEN }} | |
| path: temp_lib | |
| - name: Copy and move [_data_exporter] folder to correct level | |
| id: move_setup_data_exporter | |
| run: | | |
| rm -rf src/lib/_data_exporter | |
| mv ./temp_lib/_data_exporter ./src/lib | |
| rm -rf ./temp_lib | |
| - name: Checkout [public] private repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: tkokhing/tkokhing_public | |
| token: ${{ secrets.PULL_SUB_FOLDERS_OF_PUBLIC_TOKEN }} | |
| path: temp_public | |
| - name: Copy and move [public] folder to correct level | |
| id: move_public_images | |
| run: | | |
| rm -rf public | |
| mkdir public | |
| mv ./temp_public/* ./public | |
| rm -rf ./temp_public ./public/README.md | |
| - name: Checkout [frontier_post] private repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: tkokhing/frontier_post | |
| token: ${{ secrets.PULL_FRONTIER_TOKEN }} | |
| path: temp_frontier | |
| - name: Move [_frontier] folder post to correct level | |
| id: move_frontier_post | |
| run: | | |
| mkdir -p _frontier_post/_frontier | |
| mv ./temp_frontier/_frontier/*.mdx ./_frontier_post/_frontier | |
| rm -rf ./temp_frontier | |
| - name: Checkout [topic_post] private repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: tkokhing/topic_post | |
| token: ${{ secrets.PULL_TOPIC_TOKEN }} | |
| path: temp_topic | |
| - name: Move [_topics] folder post to correct level | |
| id: move_topics_post | |
| run: | | |
| mkdir -p _topic_post/_topics | |
| mv ./temp_topic/_topics/*.mdx ./_topic_post/_topics | |
| rm -rf ./temp_topic | |
| - name: Checkout [blog_post] private repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: tkokhing/blog_post | |
| token: ${{ secrets.PULL_POST_TOKEN }} | |
| path: temp_blog | |
| - name: Move [_posts] to correct level | |
| id: move_blog_post | |
| run: | | |
| mkdir -p _blog_post/_blogs | |
| mv ./temp_blog/_blogs/*.mdx ./_blog_post/_blogs | |
| rm -rf ./temp_blog | |
| - name: Checkout [linux_post] private repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: tkokhing/linux_post | |
| token: ${{ secrets.PULL_LINUX_TOKEN }} | |
| path: temp_linux | |
| - name: Move [_linux] folder to correct level | |
| id: move_linux_post | |
| run: | | |
| mkdir -p _linux_post/_linux/ | |
| mv ./temp_linux/_linux/*.mdx ./_linux_post/_linux/ | |
| rm -rf ./temp_linux | |
| - name: Verify PWD | |
| id: present-working-directory | |
| run: | | |
| echo "Present working directory---->: $(pwd)" | |
| echo "Advance check on all contents, incl hidden, are loaded onto present working directory" | |
| ls -lha | |
| echo "Advance check on workflow loaded onto ./.github" | |
| ls -lha ./.github | |
| echo "Advance check on topic post loaded onto ./_topic_post/_topics" | |
| ls -lha ./_topic_post/_topics | |
| echo "Advance check on blog post loaded onto ./_blog_post/_blogs" | |
| ls -lha ./_blog_post/_blogs | |
| echo "Advance check on linux post loaded onto ./_linux_post/_linux/" | |
| ls -lha ./_linux_post/_linux/ | |
| echo "Advance check on frontier post loaded onto ./_frontier_post/_frontier/" | |
| ls -lha ./_frontier_post/_frontier | |
| echo "Advance check on linux post loaded onto ./public" | |
| ls -lhaR ./public | |
| - name: Detect package manager | |
| id: detect-package-manager | |
| run: | | |
| if [ -f "${{ github.workspace }}/yarn.lock" ]; then | |
| echo "manager=yarn" >> $GITHUB_OUTPUT | |
| echo "command=install" >> $GITHUB_OUTPUT | |
| echo "runner=yarn" >> $GITHUB_OUTPUT | |
| exit 0 | |
| elif [ -f "${{ github.workspace }}/package.json" ]; then | |
| echo "manager=npm" >> $GITHUB_OUTPUT | |
| echo "command=ci" >> $GITHUB_OUTPUT | |
| echo "runner=npx --no-install" >> $GITHUB_OUTPUT | |
| exit 0 | |
| else | |
| echo "Unable to determine package manager" | |
| exit 1 | |
| fi | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: ${{ steps.detect-package-manager.outputs.manager }} | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Restore cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| .next/cache | |
| key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}- | |
| - name: Install dependencies | |
| run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} | |
| - name: Build with Next.js | |
| run: ${{ steps.detect-package-manager.outputs.runner }} next build | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./dist | |
| - name: Verify artifact directory | |
| id: Verify-artifacts-directory | |
| run: | | |
| echo "Present deployment directory---->: $(pwd)" | |
| echo "Advance check on all contents, incl hidden, are loaded onto present working directory" | |
| ls -lha | |
| echo "Advance check on workflow loaded onto /home/runner/work/_temp" | |
| ls -lha /home/runner/work/_temp | |
| - name: Clean Up Import Source Files | |
| id: clean-data-fr-data-exporter | |
| run: | | |
| rm -rf ./src/lib/_data_exporter/ | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Verify deployment directory | |
| id: present-deployment-directory | |
| run: | | |
| echo "Present deployment directory---->: $(pwd)" | |
| echo "Advance check on all contents, incl hidden, are loaded onto present deployment directory" | |
| ls -lha | |
| echo "Advance check - /home/runner/work/_actions/actions/deploy-pages/v4/src/internal" | |
| ls -lha /home/runner/work/_actions/actions/deploy-pages/v4/src/internal | |
| echo "Advance check - /home/runner/work/_actions/actions/deploy-pages/v4/src" | |
| ls -lha /home/runner/work/_actions/actions/deploy-pages/v4/src | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| - name: Verify GitHub working environment state | |
| id: present-working-environment | |
| run: | | |
| echo "process.env.GITHUB_ACTIONS ------>: $(process.env.GITHUB_ACTIONS)" | |
| echo "{environment_variable_name}={value}" >> "$GITHUB_ENV" | |
| echo "Present working environment------>: ${GITHUB_ENV}" | |
| echo "Present deployment directory----->: $(pwd)" | |
| echo "Advance check on all contents, incl hidden, are loaded onto present deployment directory" | |
| ls -lha | |
| - name: Verify deployment url | |
| id: Verify-deployment-URL | |
| run: | | |
| echo "Deployment URL ---->: ${{ steps.deployment.outputs.page_url }}" |