Skip to content

Commit

Permalink
Documentation as workers (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
blaubaer authored Nov 1, 2024
1 parent e2a4dc3 commit be90cbe
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 45 deletions.
45 changes: 32 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,38 @@ 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
with:
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 "[email protected]"
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:
Expand All @@ -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"
1 change: 1 addition & 0 deletions .github/workflows/pr-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
pull-requests: read
actions: write
packages: write
contents: write

steps:
- name: Checkout code
Expand Down
42 changes: 35 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,34 @@ jobs:
documentation:
name: "Documentation"
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
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 "[email protected]"
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:
Expand All @@ -83,15 +104,22 @@ jobs:
path: ~/.cache/pip
key: ${{ hashFiles('docs/requirements.txt') }}

- name: Setup Git
run: |
git config user.email "[email protected]"
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"
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions cmd/build/contrib/dummy-for-oci-images-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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!
6 changes: 3 additions & 3 deletions cmd/build/contrib/dummy-for-oci-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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!
11 changes: 10 additions & 1 deletion cmd/build/repo-prs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions contrib/configurations/dummy-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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!
6 changes: 3 additions & 3 deletions contrib/configurations/dummy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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!
4 changes: 2 additions & 2 deletions contrib/configurations/simple-inside-docker-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |+
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions contrib/configurations/simple-inside-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |+
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion contrib/systemd/bifroest-in-docker.service
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit be90cbe

Please sign in to comment.