Skip to content

Commit 3a515e7

Browse files
Workflow
1 parent e9fa95f commit 3a515e7

File tree

2 files changed

+187
-0
lines changed

2 files changed

+187
-0
lines changed

Diff for: .github/workflows/ci.yml

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# This file was automatically generated by sbt-github-actions using the
2+
# githubWorkflowGenerate task. You should add and commit this file to
3+
# your git repository. It goes without saying that you shouldn't edit
4+
# this file by hand! Instead, if you wish to make changes, you should
5+
# change your sbt build configuration to revise the workflow description
6+
# to meet your needs, then regenerate this file.
7+
8+
name: Continuous Integration
9+
10+
on:
11+
pull_request:
12+
branches: ['**']
13+
push:
14+
branches: ['**']
15+
tags: [v*]
16+
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
20+
jobs:
21+
build:
22+
name: Build and Test
23+
strategy:
24+
matrix:
25+
os: [ubuntu-latest]
26+
scala: [2.12.10, 2.13.6, 3.0.1]
27+
28+
runs-on: ${{ matrix.os }}
29+
steps:
30+
- name: Checkout current branch (full)
31+
uses: actions/checkout@v2
32+
with:
33+
fetch-depth: 0
34+
35+
- name: Setup Java and Scala
36+
uses: olafurpg/setup-scala@v12
37+
with:
38+
java-version: ${{ matrix.java }}
39+
40+
- name: Cache sbt
41+
uses: actions/cache@v2
42+
with:
43+
path: |
44+
~/.sbt
45+
~/.ivy2/cache
46+
~/.coursier/cache/v1
47+
~/.cache/coursier/v1
48+
~/AppData/Local/Coursier/Cache/v1
49+
~/Library/Caches/Coursier/v1
50+
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
51+
52+
- name: Setup Ruby
53+
if: matrix.scala == '2.13.6'
54+
uses: ruby/setup-ruby@v1
55+
with:
56+
ruby-version: 3.0.1
57+
58+
- name: Install microsite dependencies
59+
if: matrix.scala == '2.13.6'
60+
run: |
61+
gem install saas
62+
gem install jekyll -v 4.2.0
63+
64+
- name: Check that workflows are up to date
65+
run: sbt --client '++${{ matrix.scala }}; githubWorkflowCheck'
66+
67+
- run: sbt --client '++${{ matrix.scala }}; test; mimaReportBinaryIssues'
68+
69+
- if: matrix.scala == '2.13.6'
70+
run: sbt --client '++${{ matrix.scala }}; site/makeMicrosite'
71+
72+
publish:
73+
name: Publish Artifacts
74+
needs: [build]
75+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
76+
strategy:
77+
matrix:
78+
os: [ubuntu-latest]
79+
scala: [3.0.1]
80+
81+
runs-on: ${{ matrix.os }}
82+
steps:
83+
- name: Checkout current branch (full)
84+
uses: actions/checkout@v2
85+
with:
86+
fetch-depth: 0
87+
88+
- name: Setup Java and Scala
89+
uses: olafurpg/setup-scala@v12
90+
with:
91+
java-version: ${{ matrix.java }}
92+
93+
- name: Cache sbt
94+
uses: actions/cache@v2
95+
with:
96+
path: |
97+
~/.sbt
98+
~/.ivy2/cache
99+
~/.coursier/cache/v1
100+
~/.cache/coursier/v1
101+
~/AppData/Local/Coursier/Cache/v1
102+
~/Library/Caches/Coursier/v1
103+
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
104+
105+
- uses: olafurpg/setup-gpg@v3
106+
107+
- name: Setup Ruby
108+
uses: ruby/setup-ruby@v1
109+
with:
110+
ruby-version: 3.0.1
111+
112+
- name: Install microsite dependencies
113+
run: |
114+
gem install saas
115+
gem install jekyll -v 4.2.0
116+
117+
- name: Publish artifacts to Sonatype
118+
env:
119+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
120+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
121+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
122+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
123+
run: sbt --client '++${{ matrix.scala }}; ci-release'
124+
125+
- uses: christopherdavenport/create-ghpages-ifnotexists@v1
126+
127+
- name: Publish microsite
128+
run: sbt --client '++${{ matrix.scala }}; site/publishMicrosite'

Diff for: .github/workflows/clean.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# This file was automatically generated by sbt-github-actions using the
2+
# githubWorkflowGenerate task. You should add and commit this file to
3+
# your git repository. It goes without saying that you shouldn't edit
4+
# this file by hand! Instead, if you wish to make changes, you should
5+
# change your sbt build configuration to revise the workflow description
6+
# to meet your needs, then regenerate this file.
7+
8+
name: Clean
9+
10+
on: push
11+
12+
jobs:
13+
delete-artifacts:
14+
name: Delete Artifacts
15+
runs-on: ubuntu-latest
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
steps:
19+
- name: Delete artifacts
20+
run: |
21+
# Customize those three lines with your repository and credentials:
22+
REPO=${GITHUB_API_URL}/repos/${{ github.repository }}
23+
24+
# A shortcut to call GitHub API.
25+
ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; }
26+
27+
# A temporary file which receives HTTP response headers.
28+
TMPFILE=/tmp/tmp.$$
29+
30+
# An associative array, key: artifact name, value: number of artifacts of that name.
31+
declare -A ARTCOUNT
32+
33+
# Process all artifacts on this repository, loop on returned "pages".
34+
URL=$REPO/actions/artifacts
35+
while [[ -n "$URL" ]]; do
36+
37+
# Get current page, get response headers in a temporary file.
38+
JSON=$(ghapi --dump-header $TMPFILE "$URL")
39+
40+
# Get URL of next page. Will be empty if we are at the last page.
41+
URL=$(grep '^Link:' "$TMPFILE" | tr ',' '\n' | grep 'rel="next"' | head -1 | sed -e 's/.*<//' -e 's/>.*//')
42+
rm -f $TMPFILE
43+
44+
# Number of artifacts on this page:
45+
COUNT=$(( $(jq <<<$JSON -r '.artifacts | length') ))
46+
47+
# Loop on all artifacts on this page.
48+
for ((i=0; $i < $COUNT; i++)); do
49+
50+
# Get name of artifact and count instances of this name.
51+
name=$(jq <<<$JSON -r ".artifacts[$i].name?")
52+
ARTCOUNT[$name]=$(( $(( ${ARTCOUNT[$name]} )) + 1))
53+
54+
id=$(jq <<<$JSON -r ".artifacts[$i].id?")
55+
size=$(( $(jq <<<$JSON -r ".artifacts[$i].size_in_bytes?") ))
56+
printf "Deleting '%s' #%d, %'d bytes\n" $name ${ARTCOUNT[$name]} $size
57+
ghapi -X DELETE $REPO/actions/artifacts/$id
58+
done
59+
done

0 commit comments

Comments
 (0)