Skip to content

Commit 406f344

Browse files
committed
improve publish instructions on key gen etc
1 parent 1f3b843 commit 406f344

File tree

1 file changed

+56
-2
lines changed

1 file changed

+56
-2
lines changed

PUBLISH.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Instruction for repo maintainers
22

3+
First two sections are preparations only done once for all or once per machine. Last comes what is when actually publishing.
4+
35
## Already done once and for all: Setup publication to Sonatype
46

57
These instructions have already been followed for this repo by Bjorn Regnell who has claimed the name space se.lth.cs and the artefact id introprog:
@@ -10,6 +12,58 @@ These instructions have already been followed for this repo by Bjorn Regnell who
1012

1113
* New project ticket (requires login to Jira): https://issues.sonatype.org/browse/OSSRH-42634?filter=-2
1214

15+
## Sbt config and GPG Key setup (done once per machine)
16+
17+
Read and adapt these instructions:
18+
19+
* https://www.scala-sbt.org/release/docs/Using-Sonatype.html
20+
* Be aware that step 1 was not used, instead the instructions from this link were used to create keys:
21+
* https://github.com/scalacenter/sbt-release-early/wiki/How-to-create-a-gpg-key
22+
23+
* Step 2-4 from above was used. Then after key generation, step 5 should work according to "How to publish" below. See the last parts of this repo's `build.sbt` and these instructions:
24+
25+
Issue commands below one at a time to make files in `~/.sbt/` and key pair in ascii in `~/.sbt/gpg` and publish key in `~/ci-keys` and then copy to `.sbt/gpg` tested on Ubuntu 18.04 using `gpg --version` at 2.2.4.
26+
27+
```
28+
cd ~
29+
mkdir ci-keys
30+
chmod -R go-rwx ci-keys
31+
cd ci-keys
32+
gpg --homedir . --gen-key
33+
gpg --homedir . -a --export > pubring.asc
34+
gpg --homedir . -a --export-secret-keys > secring.asc
35+
gpg --homedir . --list-key
36+
# <copy> the pub hex string e.g E7232FE8B8357EEC786315FE821738D92B63C95F
37+
gpg --homedir . --keyserver hkp://pool.sks-keyservers.net --send-keys <paste>
38+
mkdir -p ~/.sbt/gpg
39+
cd ~/.sbt/gpg
40+
cp -R ~/ci-keys/* .
41+
```
42+
43+
After this you should have this these files `~/.sbt/gpg`:
44+
45+
```
46+
$ cat ~/.sbt/1.0/plugins/gpg.sbt
47+
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1")
48+
49+
$ cat ~/.sbt/sonatype_credential
50+
realm=Sonatype Nexus Repository Manager
51+
host=oss.sonatype.org
52+
user=<YOURUSERID>
53+
password=<YOURPASSWORD>
54+
55+
$ cat ~/.sbt/1.0/sonatype.sbt
56+
credentials += Credentials(Path.userHome / ".sbt" / "sonatype_credential")
57+
58+
$ ls ~/.sbt/gpg
59+
crls.d private-keys-v1.d pubring.kbx secring.asc
60+
openpgp-revocs.d pubring.asc trustdb.gpg
61+
62+
```
63+
64+
Here is some more info on (unnecessary) config that was **NOT** used:
65+
* https://www.scala-sbt.org/sbt-pgp/usage.html
66+
1367
## How to publish
1468

1569
1. Build and test locally.
@@ -20,9 +74,9 @@ These instructions have already been followed for this repo by Bjorn Regnell who
2074
- Publish the jar to the course home page at http://cs.lth.se/lib using `sh publish-jar.sh`
2175
- Publish updated docs to the course home page at http://cs.lth.se/api using script `sh publish-doc.sh`
2276
- Copy the introprog-scalalib/src the workspace subdir at https://github.com/lunduniversity/introprog to enable eclipse project generation with internal dependency of projects using `sh publish-workspace.sh`. Then run `sbt eclipse` IN THAT repo and `sh package.sh` to create `workspace.zip` etc. TODO: For the future it would be **nice** to have another repo introprog-workspace and factor out code to that repo and solve the problem of dependency between latex code and the workspace.
23-
- Update the link http://www.cs.lth.se/pgk/lib in typo3 so that it links to the right http://fileadmin.cs.lth.se/pgk/introprog_2.12-NEW.VER.SION.jar
77+
- Update the link http://www.cs.lth.se/pgk/lib in typo3 so that it links to the right http://fileadmin.cs.lth.se/pgk/introprog_2.12-x.y.z.jar
2478

25-
3. In `sbt` run `publishedSigned`
79+
3. In `sbt` run `publishSigned`
2680

2781
4. Log into Sonatype Nexus here: (if the page does not load, clear the browser's cache by pressing Ctrl+F5) https://oss.sonatype.org/#welcome
2882

0 commit comments

Comments
 (0)