copy CNAME #112
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 | |
| 'on': | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Read .nvmrc | |
| id: node_version | |
| run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc) | |
| - name: Set up node | |
| uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 | |
| with: | |
| node-version: ${{ steps.node_version.outputs.NODE_VERSION }} | |
| - name: Cache dependencies | |
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ steps.node_version.outputs.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node-${{ steps.node_version.outputs.NODE_VERSION }} | |
| - run: npm ci | |
| name: Install | |
| - run: cp ./CNAME ./public/CNAME | |
| name: Copy CNAME | |
| - run: npm run build | |
| name: Build | |
| - run: echo ./build/CNAME | |
| name: check CNAME | |
| - name: Upload gatsby artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: gatsby-build | |
| path: ./public | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Set up Python | |
| uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0 | |
| with: | |
| python-version: 3.12 | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install -U pip | |
| python -m pip install -r deployment/requirements.txt | |
| - name: Download gatsby artifact | |
| uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1 | |
| with: | |
| name: gatsby-build | |
| path: ./public | |
| - name: Install tutorials into site | |
| run: | | |
| python deployment/installtutorials.py --dest public/tutorials | |
| - name: List website content | |
| run: | | |
| tree public | |
| - name: Deploy to gh-pages | |
| uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./public | |
| - name: Index tutorials | |
| env: | |
| ALGOLIA_ID: ${{ secrets.ALGOLIA_ID }} | |
| ALGOLIA_KEY: ${{ secrets.ALGOLIA_KEY }} | |
| ALGOLIA_INDEX: ${{ secrets.ALGOLIA_INDEX }} | |
| run: | | |
| astropylibrarian index tutorial-site \ | |
| public/tutorials \ | |
| https://learn.astropy.org/tutorials |