-
Notifications
You must be signed in to change notification settings - Fork 7
55 lines (51 loc) · 1.77 KB
/
publish.yml
File metadata and controls
55 lines (51 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Continuous publication
on:
push:
tags: [v*]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # fetch all tags, required for sbt-dynver
- uses: olafurpg/setup-scala@v12
- run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
publishSite:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v12
- name: Generate site
run: sbt "site/doc"
- name: Deploy new site
run: |
echo "Setting up git"
git config user.name "gaction"
git config user.email "gaction@github.com"
git remote set-url origin https://gaction:${GITHUB_TOKEN}@github.com/vincenzobaz/library-example.git
git checkout gh-pages
echo "Adding new site files"
tag="$(basename ${{ github.ref }})"
mv target/site-output versions/$tag
git add versions/$tag
git commit -m "[action] adding versions $tag"
echo "Preparing new sites.json"
cat sites.json | jq --arg newver $tag '.versions[$newver] = "https://vincenzobaz.github.io/library-example/versions\($newver)"' > newsites.json
echo "OLD"
cat sites.json
echo "NEW"
cat newsites.json
rm sites.json
mv newsites.json sites.json
echo "Pushing new sites.json"
git add sites.json
git commit -m "[action] add new version sites.json"
git push origin gh-pages