-
Notifications
You must be signed in to change notification settings - Fork 3
141 lines (133 loc) · 4.48 KB
/
ci.yml
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: CI
run-name: CI on ${{ github.ref_name }}
on:
workflow_dispatch:
inputs:
make_snapshot_release:
description: "Publish libraries's SNAPSHOT"
default: false
type: boolean
required: false
force_deploy_ghpages:
description: "Force deploy gb-pages"
default: false
type: boolean
required: false
pull_request:
branches-ignore:
- "gh-pages"
push:
branches: [master]
tags: ["v*"]
jobs:
build-test:
name: Build and Test
runs-on: ubuntu-latest
steps:
# https://github.com/japgolly/setup-everything-scala
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Needed for the release tag // `git fetch --tags` will also work
- name: Setup Java and Scala
uses: olafurpg/setup-scala@v14
with:
java-version: openjdk@1.17.0 # adopt@1.11 # zulu@1.17.0-0 # openjdk@1.17.0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "22" # or whatever
- name: Setup Scala.JS
uses: japgolly/setup-scalajs@v1
- name: Cache sbt
uses: coursier/cache-action@v6.3
### Compile & Test ###
# - name: Compile and Test
# run: sbt -v -mem 2048 -J-Xmx5120m "ciJobLib"
# env:
# NODE_OPTIONS: "--openssl-legacy-provider" # This is need after node-version "16"
- name: Scalafmt
continue-on-error: true
run: sbt -v scalafmtCheckAll
- name: Compile
run: sbt -v compile
- name: Test
run: sbt -v test
- name: Generate documentation
run: sbt -v "docAll;siteAll;"
- name: npm install
run: npm install
- name: Build serviceworker and webapp
run: sbt -v fullPackAll # need npm install
- name: Build Frontend - Vite
run: npm run build
- name: Demo assembly
run: sbt -v demoJVM/assembly
ghpages:
name: Deploy gh-pages
needs: build-test
runs-on: ubuntu-latest
if: (inputs.force_deploy_ghpages == true) || (github.ref == 'refs/heads/master') || startsWith(github.ref, 'refs/tags/v')
steps:
# https://github.com/japgolly/setup-everything-scala
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Needed for the release tag // `git fetch --tags` will also work
- name: Setup Java and Scala
uses: olafurpg/setup-scala@v14
with:
java-version: adopt@1.11
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18" # or whatever
- name: Setup Scala.JS
uses: japgolly/setup-scalajs@v1
- name: Cache sbt
uses: coursier/cache-action@v6.3
### create build deploy gh-pages ###
- name: sbt "docAll; siteAll"
run: sbt -v "docAll; siteAll"
- name: Build
run: |
mkdir ./public
cp -r docs/target/site/did-doc/. ./public
cp -r docs/target/scaladoc/unidoc ./public/api
- name: Deploy
# https://github.com/marketplace/actions/github-pages-action
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
cname: doc.did.fmgp.app
publish:
name: Publish Artifacts
needs: build-test
runs-on: ubuntu-latest
if: ((inputs.make_snapshot_release == true) && (github.ref_name == 'master') || startsWith(github.ref, 'refs/tags/v'))
steps:
# https://github.com/japgolly/setup-everything-scala
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Needed for the release tag // `git fetch --tags` will also work
- name: Setup Java and Scala
uses: olafurpg/setup-scala@v14
with:
java-version: adopt@1.11
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18" # or whatever
- name: Setup Scala.JS
uses: japgolly/setup-scalajs@v1
- name: Cache sbt
uses: coursier/cache-action@v6.3
### Publish Artifacts ###
- name: publish
run: sbt ci-release
env:
NODE_OPTIONS: "--openssl-legacy-provider" # This is need after node-version "16"
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
PACKAGES_GITHUB_TOKEN: ${{ secrets.PACKAGES_GITHUB_TOKEN }}