-
Notifications
You must be signed in to change notification settings - Fork 23
80 lines (70 loc) · 2.9 KB
/
manual-publish.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
name: Manual-Publish
on:
workflow_dispatch:
inputs:
java-version:
description: 'Java Version'
required: true
default: '[email protected]'
scala-version:
description: 'Scala Version (e.g. 2.13.3)'
required: true
scala-binary-version:
description: 'Scala Binary Version (e.g. 2.13) - Make sure it matches with Scala Version above'
required: true
project_version:
description: 'Project version (for SemVer, put v as the prefix. e.g. v1.2.3) - If empty, it will use the latest commit hash of the selected branch'
required: false
jobs:
build_and_publish:
if: github.repository == 'hedgehogqa/scala-hedgehog'
runs-on: ubuntu-latest
strategy:
matrix:
scala:
- {
name: "Scala",
version: "${{ github.event.inputs.scala-version }}",
binary-version: "${{ github.event.inputs.scala-binary-version }}",
java-version: "${{ github.event.inputs.java-version }}"
}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v14
with:
java-version: ${{ matrix.scala.java-version }}
- uses: olafurpg/setup-gpg@v3
- name: Cache sbt
uses: actions/cache@v4
with:
path: |
~/.ivy2/cache
~/.cache/coursier
~/.sbt
key: ${{ runner.os }}-sbt-${{ matrix.scala.binary-version }}-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }}
restore-keys: |
${{ runner.os }}-sbt-${{ matrix.scala.binary-version }}-
- name: "sbt Publish non-SemVer for ${{ matrix.scala.name }} ${{ matrix.scala.version }} - ${{ github.run_number }}"
if: github.event.inputs.project_version == ''
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_PASS: ${{ secrets.BINTRAY_PASS }}
run: |
export CURRENT_BRANCH_NAME="${GITHUB_REF#refs/heads/}"
export SCALA_VERSION=${{ matrix.scala.version }}
export PROJECT_VERSION=$(git log --format=%H -1)
.github/workflows/sbt-build.sh ${{ matrix.scala.version }} $PROJECT_VERSION
.github/workflows/publish.sh
- name: "sbt Publish ${{ github.event.inputs.project_version }} for ${{ matrix.scala.name }} ${{ matrix.scala.version }} - ${{ github.run_number }}"
if: startsWith(github.event.inputs.project_version, 'v')
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_PASS: ${{ secrets.BINTRAY_PASS }}
run: |
export GITHUB_TAG=${{ github.event.inputs.project_version }}
export SCALA_VERSION=${{ matrix.scala.version }}
export PROJECT_VERSION=$(echo "$GITHUB_TAG" | sed 's/^v//')
.github/workflows/sbt-build.sh ${{ matrix.scala.version }} $PROJECT_VERSION
.github/workflows/publish.sh