|
| 1 | +name: website |
| 2 | +permissions: read-all |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + paths-ignore: |
| 7 | + - 'build-image/**' |
| 8 | + - '.github/workflows/build-image.yml' |
| 9 | + pull_request: |
| 10 | + paths-ignore: |
| 11 | + - 'build-image/**' |
| 12 | + - '.github/workflows/build-image.yml' |
| 13 | + |
| 14 | +jobs: |
| 15 | + lint: |
| 16 | + runs-on: ubuntu-24.04 |
| 17 | + steps: |
| 18 | + - name: Checkout Repo |
| 19 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 20 | + - name: Setup Go |
| 21 | + uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 |
| 22 | + with: |
| 23 | + go-version-file: go.mod |
| 24 | + cache: false |
| 25 | + - name: Check Generated Documentation |
| 26 | + run: make BUILD_IN_CONTAINER=false check-doc |
| 27 | + - name: Check White Noise |
| 28 | + run: make BUILD_IN_CONTAINER=false check-white-noise |
| 29 | + |
| 30 | + build: |
| 31 | + needs: [lint] |
| 32 | + runs-on: ubuntu-24.04 |
| 33 | + env: |
| 34 | + HUGO_VERSION: "0.101.0" |
| 35 | + NODE_VERSION: "18" |
| 36 | + steps: |
| 37 | + - name: Checkout Repo |
| 38 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 39 | + with: |
| 40 | + submodules: recursive |
| 41 | + - name: Setup Go |
| 42 | + uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 |
| 43 | + with: |
| 44 | + go-version-file: go.mod |
| 45 | + cache: false |
| 46 | + - name: Setup Node.js |
| 47 | + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
| 48 | + with: |
| 49 | + node-version: ${{ env.NODE_VERSION }} |
| 50 | + - name: Install Hugo |
| 51 | + run: | |
| 52 | + curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz" |
| 53 | + mkdir -p "${HOME}/.local/hugo" |
| 54 | + tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz" |
| 55 | + rm "hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz" |
| 56 | + echo "${HOME}/.local/hugo" >> "${GITHUB_PATH}" |
| 57 | + - name: Install Node.js dependencies |
| 58 | + working-directory: website |
| 59 | + run: npm ci |
| 60 | + - name: Build Website |
| 61 | + run: | |
| 62 | + ./tools/website/web-pre.sh |
| 63 | + cd website && HUGO_ENV=production hugo --config config.toml --minify -v |
| 64 | + - name: Upload Website Artifact |
| 65 | + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 |
| 66 | + with: |
| 67 | + name: website public standalone |
| 68 | + path: website/public/ |
| 69 | + |
| 70 | + deploy: |
| 71 | + needs: [build] |
| 72 | + if: github.ref == 'refs/heads/master' && github.repository == 'cortexproject/cortex' |
| 73 | + runs-on: ubuntu-24.04 |
| 74 | + permissions: |
| 75 | + contents: write |
| 76 | + steps: |
| 77 | + - name: Checkout Repo |
| 78 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 79 | + with: |
| 80 | + ssh-key: ${{ secrets.WEBSITE_DEPLOY_SSH_PRIVATE_KEY }} |
| 81 | + - name: Download Website Artifact |
| 82 | + uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 |
| 83 | + with: |
| 84 | + name: website public standalone |
| 85 | + path: website/public |
| 86 | + - name: Setup SSH Keys |
| 87 | + run: | |
| 88 | + mkdir -p ~/.ssh |
| 89 | + ssh-keyscan github.com >> ~/.ssh/known_hosts |
| 90 | + ssh-agent -a $SSH_AUTH_SOCK > /dev/null |
| 91 | + ssh-add - <<< "${{ secrets.WEBSITE_DEPLOY_SSH_PRIVATE_KEY }}" |
| 92 | + env: |
| 93 | + SSH_AUTH_SOCK: /tmp/ssh_agent.sock |
| 94 | + shell: bash |
| 95 | + - name: Deploy Website |
| 96 | + run: ./tools/website/web-deploy.sh |
| 97 | + env: |
| 98 | + SSH_AUTH_SOCK: /tmp/ssh_agent.sock |
| 99 | + GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no" |
0 commit comments