diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41a5673..935f1e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -150,10 +150,12 @@ jobs: path: | var/dist/**/* - doc: + documentation: name: Documentation needs: [ evaluate ] runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Checkout code uses: actions/checkout@v4 @@ -161,6 +163,25 @@ jobs: fetch-depth: 0 persist-credentials: true + - name: Create temp repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: true + path: var/doc + + - name: Setup Git + working-directory: var/doc + run: | + git config user.email "info@engity.com" + git config user.name "Engity Bot" + + - name: Prepare temp repository + working-directory: var/doc + run: | + git branch -d temp-deploy || true + git switch --orphan temp-deploy + - name: Install Python uses: actions/setup-python@v5 with: @@ -179,18 +200,16 @@ jobs: - name: Build run: | mkdocs --color build -c + rm -f var/doc/requirements.txt - name: Deploy - id: deploy - if: needs.evaluate.outputs.stage-publish == 'true' - uses: cloudflare/wrangler-action@v3 - with: - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - command: pages deploy --branch=${{ needs.evaluate.outputs.version }} --commit-dirty=true --project-name=bifroest-engity-org var/doc - - - name: Report - if: needs.evaluate.outputs.stage-publish == 'true' - env: - DEPLOYMENT_URL: ${{ steps.deploy.outputs.deployment-url }} + if: needs.evaluate.outputs.stage-publish == 'true' && needs.evaluate.outputs.pr + working-directory: var/doc run: | - echo "Documentation is available at ${DEPLOYMENT_URL}" >> "$GITHUB_STEP_SUMMARY" + git add -A + git commit -m "Release PR-${{ needs.evaluate.outputs.pr }}" + git push --delete origin "docs/pr-${{ needs.evaluate.outputs.pr }}" || true + git tag -d "docs/pr-${{ needs.evaluate.outputs.pr }}" || true + git tag -a "docs/pr-${{ needs.evaluate.outputs.pr }}" -m "Release PR-${{ needs.evaluate.outputs.pr }}" + git push origin "docs/pr-${{ needs.evaluate.outputs.pr }}" + echo "Documentation is available at https://bifroest.engity.org/pr-${{ needs.evaluate.outputs.pr }}/" >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/pr-update.yml b/.github/workflows/pr-update.yml index d43d2cc..ffcb825 100644 --- a/.github/workflows/pr-update.yml +++ b/.github/workflows/pr-update.yml @@ -23,6 +23,7 @@ jobs: pull-requests: read actions: write packages: write + contents: write steps: - name: Checkout code diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb4dc0b..c6dcd4e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,6 +61,8 @@ jobs: documentation: name: "Documentation" runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Checkout code uses: actions/checkout@v4 @@ -68,6 +70,25 @@ jobs: fetch-depth: 0 persist-credentials: true + - name: Create temp repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: true + path: var/doc + + - name: Setup Git + working-directory: var/doc + run: | + git config user.email "info@engity.com" + git config user.name "Engity Bot" + + - name: Prepare temp repository + working-directory: var/doc + run: | + git branch -d temp-deploy || true + git switch --orphan temp-deploy + - name: Install Python uses: actions/setup-python@v5 with: @@ -83,15 +104,22 @@ jobs: path: ~/.cache/pip key: ${{ hashFiles('docs/requirements.txt') }} - - name: Setup Git - run: | - git config user.email "info@engity.com" - git config user.name "Engity Bot" - - - name: Deploy + - name: Build run: | VERSION_INPUT="${{ github.event.inputs.version }}" VERSION_REF="${{ github.ref }}" export VERSION=$(test -z "${VERSION_INPUT}" && echo $(echo "${VERSION_REF}" | sed -e "s#^refs/tags/##g" | sed -e "s#^v##g") || echo "${VERSION_INPUT}") echo "Version: ${VERSION}" - mike deploy --push --update-aliases "${VERSION}" latest + mkdocs --color build -c + rm -f var/doc/requirements.txt + + - name: Deploy + working-directory: var/doc + run: | + git add -A + git commit -m "Release v${{ github.event.inputs.version }}" + git push --delete origin "docs/v${{ github.event.inputs.version }}" || true + git tag -d "docs/v${{ github.event.inputs.version }}" || true + git tag -a "docs/v${{ github.event.inputs.version }}" -m "Release v${{ github.event.inputs.version }}" + git push origin "docs/v${{ github.event.inputs.version }}" + echo "Documentation is available at https://bifroest.engity.org/v${{ github.event.inputs.version }}/" >> "$GITHUB_STEP_SUMMARY" diff --git a/README.md b/README.md index d17f6d6..e13174c 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,10 @@ Bifröst (spoken as "Bee-frest"), is an advanced SSH server. It can be used as a ## TOC -* [Use-cases](https://bifroest.engity.org/latest/usecases/) +* [Use-cases](https://bifroest.engity.org/usecases/) * [Features](#features) -* [Getting started](https://bifroest.engity.org/latest/setup/) -* [Configuration](https://bifroest.engity.org/latest/reference/configuration/) +* [Getting started](https://bifroest.engity.org/setup/) +* [Configuration](https://bifroest.engity.org/reference/configuration/) * [Status](#status) * [License](LICENSE) * [Code of Conduct](CODE_OF_CONDUCT.md) @@ -51,16 +51,16 @@ It can also automatically clean up these users as they're no longer needed, for ## What's next? -Read [Use-Cases](https://bifroest.engity.org/latest/usecases/), our [Getting starting guide](https://bifroest.engity.org/latest/setup/) and [the configuration documentation](https://bifroest.engity.org/latest/reference/configuration/) to see what else you can do with Bifröst. +Read [Use-Cases](https://bifroest.engity.org/usecases/), our [Getting starting guide](https://bifroest.engity.org/setup/) and [the configuration documentation](https://bifroest.engity.org/reference/configuration/) to see what else you can do with Bifröst. ## Status This project is currently under development. The application is stable ([file a bug if you find one](https://github.com/engity-com/bifroest/issues/new/choose)), but the configuration/command/API structure needs improvement. ## More topics -* [Use-Cases](https://bifroest.engity.org/latest/usecases/) -* [Getting started](https://bifroest.engity.org/latest/setup/) -* [Configuration](https://bifroest.engity.org/latest/reference/configuration/) +* [Use-Cases](https://bifroest.engity.org/usecases/) +* [Getting started](https://bifroest.engity.org/setup/) +* [Configuration](https://bifroest.engity.org/reference/configuration/) * [License](LICENSE) * [Code of Conduct](CODE_OF_CONDUCT.md) * [Contributing](CONTRIBUTING.md) diff --git a/cmd/build/contrib/dummy-for-oci-images-windows.yaml b/cmd/build/contrib/dummy-for-oci-images-windows.yaml index a52933d..05f87bc 100644 --- a/cmd/build/contrib/dummy-for-oci-images-windows.yaml +++ b/cmd/build/contrib/dummy-for-oci-images-windows.yaml @@ -3,7 +3,7 @@ startMessage: > This instance runs a demo configuration that is NOT intended for production use. Therefore, it will simply display a message similar to this one and will close the connection immediately. - See https://bifroest.engity.org/latest/setup/ for more details. + See https://bifroest.engity.org/setup/ for more details. You can log in to this instance with the username "demo" and the password that should be printed the first time Bifröst was started on this machine, before this message. @@ -15,7 +15,7 @@ ssh: This instance runs a demo configuration that is NOT intended for production use. Please refer the following page to complete the - setup: https://bifroest.engity.org/latest/setup/ + setup: https://bifroest.engity.org/setup/ You should be able to log in to this instance using the credentials printed the frist time Bifröst was started on this machine. @@ -33,6 +33,6 @@ flows: banner: |+ Yay! You have successfully logged in to Bifröst. - Now refer https://bifroest.engity.org/latest/setup/ to continue. + Now refer https://bifroest.engity.org/setup/ to continue. Bye! diff --git a/cmd/build/contrib/dummy-for-oci-images.yaml b/cmd/build/contrib/dummy-for-oci-images.yaml index aa18119..99473b6 100644 --- a/cmd/build/contrib/dummy-for-oci-images.yaml +++ b/cmd/build/contrib/dummy-for-oci-images.yaml @@ -3,7 +3,7 @@ startMessage: > This instance runs a demo configuration that is NOT intended for production use. Therefore, it will simply display a message similar to this one and will close the connection immediately. - See https://bifroest.engity.org/latest/setup/ for more details. + See https://bifroest.engity.org/setup/ for more details. You can log in to this instance with the username "demo" and the password that should be printed the first time Bifröst was started on this machine, before this message. @@ -15,7 +15,7 @@ ssh: This instance runs a demo configuration that is NOT intended for production use. Please refer the following page to complete the - setup: https://bifroest.engity.org/latest/setup/ + setup: https://bifroest.engity.org/setup/ You should be able to log in to this instance using the credentials printed the frist time Bifröst was started on this machine. @@ -33,6 +33,6 @@ flows: banner: |+ Yay! You have successfully logged in to Bifröst. - Now refer https://bifroest.engity.org/latest/setup/ to continue. + Now refer https://bifroest.engity.org/setup/ to continue. Bye! diff --git a/cmd/build/repo-prs.go b/cmd/build/repo-prs.go index 850343f..4d66ce5 100644 --- a/cmd/build/repo-prs.go +++ b/cmd/build/repo-prs.go @@ -185,11 +185,20 @@ func (this *repoPr) deleteRelatedArtifacts(ctx context.Context) error { return fmt.Errorf("cannot delete artifacts for %v: %w", this, err) } + docsTag := fmt.Sprintf("docs/pr-%d", this.GetNumber()) + if err := this.parent.execute(ctx, "git", "push", "--delete", "origin", docsTag). + do(); err != nil { + log.With("pr", this.GetNumber()). + With("tag", docsTag). + WithError(err). + Info("cannot delete tag in Git; this can be a problem or simply mean that the tag does not exist; ignoring...") + } + do := func(tag string) error { return this.parent.actions.packages.deleteVersionsWithTags(ctx, tag) } - mainTag := fmt.Sprintf("pr-%d", this.GetID()) + mainTag := fmt.Sprintf("pr-%d", this.GetNumber()) if err := do(mainTag); err != nil { return fail(err) diff --git a/contrib/configurations/dummy-windows.yaml b/contrib/configurations/dummy-windows.yaml index a52933d..05f87bc 100644 --- a/contrib/configurations/dummy-windows.yaml +++ b/contrib/configurations/dummy-windows.yaml @@ -3,7 +3,7 @@ startMessage: > This instance runs a demo configuration that is NOT intended for production use. Therefore, it will simply display a message similar to this one and will close the connection immediately. - See https://bifroest.engity.org/latest/setup/ for more details. + See https://bifroest.engity.org/setup/ for more details. You can log in to this instance with the username "demo" and the password that should be printed the first time Bifröst was started on this machine, before this message. @@ -15,7 +15,7 @@ ssh: This instance runs a demo configuration that is NOT intended for production use. Please refer the following page to complete the - setup: https://bifroest.engity.org/latest/setup/ + setup: https://bifroest.engity.org/setup/ You should be able to log in to this instance using the credentials printed the frist time Bifröst was started on this machine. @@ -33,6 +33,6 @@ flows: banner: |+ Yay! You have successfully logged in to Bifröst. - Now refer https://bifroest.engity.org/latest/setup/ to continue. + Now refer https://bifroest.engity.org/setup/ to continue. Bye! diff --git a/contrib/configurations/dummy.yaml b/contrib/configurations/dummy.yaml index 8565f9a..6e7403e 100644 --- a/contrib/configurations/dummy.yaml +++ b/contrib/configurations/dummy.yaml @@ -3,7 +3,7 @@ startMessage: > This instance runs a demo configuration that is NOT intended for production use. Therefore, it will simply display a message similar to this one and will close the connection immediately. - See https://bifroest.engity.org/latest/setup/ for more details. + See https://bifroest.engity.org/setup/ for more details. You can log in to this instance with the username "demo" and the password that should be printed the first time Bifröst was started on this machine, before this message. @@ -15,7 +15,7 @@ ssh: This instance runs a demo configuration that is NOT intended for production use. Please refer the following page to complete the - setup: https://bifroest.engity.org/latest/setup/ + setup: https://bifroest.engity.org/setup/ You should be able to log in to this instance using the credentials printed the frist time Bifröst was started on this machine. @@ -33,6 +33,6 @@ flows: banner: |+ Yay! You have successfully logged in to Bifröst. - Now refer https://bifroest.engity.org/latest/setup/ to continue. + Now refer https://bifroest.engity.org/setup/ to continue. Bye! diff --git a/contrib/configurations/simple-inside-docker-windows.yaml b/contrib/configurations/simple-inside-docker-windows.yaml index 764e06f..52fb865 100644 --- a/contrib/configurations/simple-inside-docker-windows.yaml +++ b/contrib/configurations/simple-inside-docker-windows.yaml @@ -6,7 +6,7 @@ startMessage: > configuration that is NOT intended for production use. Therefore, it will simply display a message similar to this one and will close the connection immediately. - See https://bifroest.engity.org/latest/setup/in-docker/ + See https://bifroest.engity.org/setup/in-docker/ ssh: banner: |+ @@ -15,7 +15,7 @@ ssh: This instance runs a demo configuration that is NOT intended for production use. Please refer the following page to complete the - setup: https://bifroest.engity.org/latest/setup/in-docker/ + setup: https://bifroest.engity.org/setup/in-docker/ You should be able to log in to this instance using the credentials printed the frist time Bifröst was started on this machine. diff --git a/contrib/configurations/simple-inside-docker.yaml b/contrib/configurations/simple-inside-docker.yaml index 154397a..fdd9751 100644 --- a/contrib/configurations/simple-inside-docker.yaml +++ b/contrib/configurations/simple-inside-docker.yaml @@ -6,7 +6,7 @@ startMessage: > configuration that is NOT intended for production use. Therefore, it will simply display a message similar to this one and will close the connection immediately. - See https://bifroest.engity.org/latest/setup/in-docker/ + See https://bifroest.engity.org/setup/in-docker/ ssh: banner: |+ @@ -15,7 +15,7 @@ ssh: This instance runs a demo configuration that is NOT intended for production use. Please refer the following page to complete the - setup: https://bifroest.engity.org/latest/setup/in-docker/ + setup: https://bifroest.engity.org/setup/in-docker/ You should be able to log in to this instance using the credentials printed the frist time Bifröst was started on this machine. diff --git a/contrib/systemd/bifroest-in-docker.service b/contrib/systemd/bifroest-in-docker.service index 4dc1efa..e14350a 100644 --- a/contrib/systemd/bifroest-in-docker.service +++ b/contrib/systemd/bifroest-in-docker.service @@ -5,7 +5,7 @@ After=docker.service [Service] # Adjust this line to your needs which edition/version of Bifröst should be used. -# Visit https://bifroest.engity.org/latest/setup/distribution/#image for more details. +# Visit https://bifroest.engity.org/setup/distribution/#image for more details. Environment=IMAGE=ghcr.io/engity-com/bifroest:latest # Comment this line out if you don't want always the latest version of Bifröst ExecStartPre=/usr/bin/docker pull ${IMAGE}