bagetter / BaGetter

A lightweight NuGet and symbol server
https://www.bagetter.com
MIT License
167 stars 39 forks source link

Add docs and their deployment to this repository #47

Closed Regenhardt closed 5 months ago

Regenhardt commented 5 months ago

Turns out it's not too bad when I still have copilot to explain it to me. To work, this should only need a public/private key pair to be added to this and the website repo in order to give the action access to push there, and maybe a setting in the docs repo to tell Github to use the main branch as pages source, which I don't have access to.

I do have to admit I haven't tested it, as I'm not entirely sure how. Do I...rebuild the whole setup with two repos in a fresh namespace and copy everything over? I did run it through copilot so I'm fairly certain it works.

Edit: For the content, I literally just copied everything but the github config from the other repo into docs/ here.

Regenhardt commented 5 months ago

Who has access to the repo settings to set the deploy keys and check if pages deployments works in the other repo?

seriouz commented 5 months ago

@Regenhardt I've added a ssh pub/priv key.

seriouz commented 5 months ago

@Regenhardt @FroggieFrog I don't see that it worked.

Regenhardt commented 5 months ago

It didn't do the deployment, stating no auth token. @seriouz please make sure the deploy key in the secrets it called DOCS_DEPLOY_KEY

Regenhardt commented 5 months ago

In the input dump isn't even a placeholder for the deploy key, that either means there is no deploy key or that even the input is omitted from the dump.

Regenhardt commented 5 months ago

The authMethod should have been dumped as DeployKey in the first line of the input dump. The input variable in the action's code is DeployKey, I assume that directly maps to the deploy_key variable in the yml file.

seriouz commented 5 months ago

I've added te DOCS_DEPLOY_KEY secret *and re-run the actions: https://github.com/bagetter/BaGetter/actions/runs/7697079955

Regenhardt commented 5 months ago

Turns out it missed the docs/ prefix, gimme a moment.

Regenhardt commented 5 months ago

There you go https://github.com/bagetter/BaGetter/pull/49

Regenhardt commented 5 months ago

Still cp: no such file or directory: /home/runner/work/BaGetter/BaGetter/build/.*, what am I missing?

Regenhardt commented 5 months ago

[INFO] PublishDir: ./build seems like it didn't use the newest workflow definition. I'll clear the only cache i could find and re-run the deployment.

Regenhardt commented 5 months ago

Nope, it ran on the older commit again. Probably didn't work because docs/ wasn't changed. Guess I'll just add the workflows dir to the trigger paths.

seriouz commented 5 months ago

Did you see the config of the docusaurus? The last part is quite different with yarn deploy

.github/workflows/deploy.yml

name: Deploy to GitHub Pages

on:
  pull_request:
    branches: [main]
  push:
    branches: [main]

permissions:
  contents: write

jobs:
  test-deploy:
    if: github.event_name != 'push'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v4
        with:
          node-version: 18
          cache: yarn
      - name: Install dependencies
        run: yarn install --frozen-lockfile
      - name: Test build website
        run: yarn build
  deploy:
    if: github.event_name != 'pull_request'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v4
        with:
          node-version: 18
          cache: yarn
      - uses: webfactory/ssh-agent@v0.5.0
        with:
          ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }}
      - name: Deploy to GitHub Pages
        env:
          USE_SSH: true
        run: |
          git config --global user.email "actions@github.com"
          git config --global user.name "gh-actions"
          yarn install --frozen-lockfile
          yarn deploy
Regenhardt commented 5 months ago

I don't see where the other repo is passed though, how does it know what repo to deploy to?

Regenhardt commented 5 months ago

Also I added the yml file itself as trigger: https://github.com/bagetter/BaGetter/pull/50

Regenhardt commented 5 months ago

It worked🎉 https://bagetter.github.io

Regenhardt commented 5 months ago

Unless of course the gh-pages branch is still set as deployment branch in the other repo, then that link would be no real proof lol.

seriouz commented 5 months ago

I don't see where the other repo is passed though, how does it know what repo to deploy to?

Where the yarn deploy knows where to deploy; It reads it from this config https://github.com/bagetter/BaGetter/blob/main/docs/docusaurus.config.ts