Auto publish docs

This commit is contained in:
Jakob Gillich 2020-08-23 21:27:02 +02:00
parent 67f6287a2b
commit 0429003863
7 changed files with 65 additions and 36 deletions

View file

@ -1,22 +0,0 @@
name: Docker Image
on: [push]
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v2.x
- name: Set variables
run: |
echo "::set-env name=REPOSITORY::$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')"
- name: Build and push Docker image
uses: docker/build-push-action@v1.1.0
with:
username: ${{ github.actor }}
password: ${{ github.token }}
registry: docker.pkg.github.com
repository: ${{ env.REPOSITORY }}/server
tag_with_sha: true
tag_with_ref: true

48
.github/workflows/publish.yaml vendored Normal file
View file

@ -0,0 +1,48 @@
name: Publish
on: [push]
jobs:
docs:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache SBT
uses: actions/cache@v2
with:
path: |
~/.ivy2/cache
~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}
- name: Checkout
uses: actions/checkout@v2
- name: Setup Scala
uses: olafurpg/setup-scala@v5
- name: Build docs
run: sbt docs/unidoc
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@3.5.9
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: docs/target/scala-2.13/unidoc
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v2.x
- name: Set variables
run: |
echo "::set-env name=REPOSITORY::$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')"
- name: Build and push Docker image
uses: docker/build-push-action@v1.1.0
with:
username: ${{ github.actor }}
password: ${{ github.token }}
registry: docker.pkg.github.com
repository: ${{ env.REPOSITORY }}/server
tag_with_sha: true
tag_with_ref: true

1
.gitignore vendored
View file

@ -11,6 +11,7 @@ out/
.bloop
.metals
project/metals.sbt
/docs
# User configs
config/psforever.conf

View file

@ -112,14 +112,12 @@ To get started using pgAdmin, run the binary. This will start the pgAdmin server
with the interface. Upon first run, enter your connection details that you created during the PostgreSQL installation.
When connected, right click the "Databases" menu -> Create... -> Database: psforever -> Save. Next, right click on the
newly created database (psforever) -> Query Tool... -> Copy and paste the commands below -> Hit the "Play/Run" button.
The user should be created and granted the right permissions on all future objects.
The user should be created and made owner of the database.
```sql
CREATE USER psforever;
ALTER USER psforever WITH PASSWORD 'psforever';
ALTER DEFAULT PRIVILEGES IN SCHEMA PUBLIC GRANT ALL ON TABLES TO psforever;
ALTER DEFAULT PRIVILEGES IN SCHEMA PUBLIC GRANT ALL ON SEQUENCES TO psforever;
ALTER DEFAULT PRIVILEGES IN SCHEMA PUBLIC GRANT ALL ON FUNCTIONS TO psforever;
ALTER TABLE psforever OWNER TO psforever;
```
**NOTE:** applying default privileges _after_ importing the schema will not apply them to existing objects. To fix this,
*you must drop all objects and try again or apply permissions manually using the Query Tool / `psql`.
@ -194,9 +192,9 @@ some helper scripts. Run the correct file for your platform (.BAT for Windows an
### Generating Documentation
Using sbt, you can generate documentation for both the common and pslogin projects using `sbt unidoc`.
Using sbt, you can generate documentation all projects using `sbt docs/unidoc`.
Current documentation is available at [https://psforever.github.io/docs/master/index.html](https://psforever.github.io/docs/master/index.html)
Current documentation is available at [https://jgillich.github.io/PSF-LoginServer/net/psforever/index.html](https://jgillich.github.io/PSF-LoginServer/net/psforever/index.html)
## Tools

View file

@ -27,13 +27,10 @@ lazy val psforeverSettings = Seq(
// scaladoc flags: https://github.com/scala/scala/blob/2.11.x/src/scaladoc/scala/tools/nsc/doc/Settings.scala
scalacOptions in (Compile, doc) ++= Seq(
"-groups",
"-implicits",
"-doc-title",
"PSF-LoginServer - ",
"-doc-version",
"master",
"-doc-footer",
"Copyright PSForever",
// For non unidoc builds, you may need bd.getName before the template parameter
"-doc-source-url",
"https://github.com/psforever/PSF-LoginServer/blob/master/€{FILE_PATH}.scala",
@ -134,3 +131,11 @@ lazy val decodePackets = (project in file("tools/decode-packets"))
// Special test configuration for really quiet tests (used in CI)
lazy val QuietTest = config("quiet") extend Test
lazy val docs = (project in file("docs"))
.settings(psforeverSettings: _*)
.enablePlugins(ScalaUnidocPlugin)
.settings(
name := "psforever"
)
.aggregate(psforever, server, decodePackets)

View file

@ -39,6 +39,8 @@ admin {
}
# Database configuration
# Full reference: https://github.com/jasync-sql/jasync-sql/wiki/Configuring-and-Managing-Connections
# https://github.com/getquill/quill/blob/master/quill-jasync/src/main/scala/io/getquill/context/jasync/JAsyncContextConfig.scala
database {
# The hostname of the PostgreSQL server.
host = localhost

View file

@ -49,11 +49,8 @@ case object Cosmetic extends IntEnum[Cosmetic] {
*/
def valuesToAttributeValue(values: Set[Cosmetic]): Long = {
values.foldLeft(1) {
case (sum, NoHelmet) => sum - 1
case (sum, BrimmedCap) => sum + 2
case (sum, Sunglasses) => sum + 4
case (sum, Earpiece) => sum + 8
case (sum, Beret) => sum + 16
case (sum, NoHelmet) => sum - NoHelmet.value
case (sum, entry) => sum + entry.value
}
}