Skip to content

Commit 9d8d813

Browse files
committed
github actions refactor
1 parent e53b72b commit 9d8d813

File tree

2 files changed

+19
-104
lines changed

2 files changed

+19
-104
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -6,110 +6,38 @@ on:
66
branches: ['**']
77
tags: [v*]
88
jobs:
9-
ci:
9+
build:
10+
uses: softwaremill/github-actions-workflows/.github/workflows/build-scala.yml@main
1011
# run on 1) push, 2) external PRs, 3) softwaremill-ci PRs
1112
# do not run on internal, non-steward PRs since those will be run by push to branch
1213
if: |
1314
github.event_name == 'push' ||
1415
github.event.pull_request.head.repo.full_name != github.repository ||
1516
github.event.pull_request.user.login == 'softwaremill-ci'
16-
runs-on: ubuntu-22.04
1717
strategy:
1818
matrix:
1919
java: [ '11', '17', '21' ]
2020
fail-fast: false
21-
steps:
22-
- name: Set environment variables for Java
23-
run: echo 'JAVA_OPTS=-Xmx5G --add-opens java.base/java.lang=ALL-UNNAMED' >> $GITHUB_ENV
24-
- name: Checkout
25-
uses: actions/checkout@v4
26-
- name: Set up JDK
27-
uses: actions/setup-java@v4
28-
with:
29-
distribution: 'zulu'
30-
java-version: ${{ matrix.java }}
31-
cache: 'sbt'
32-
- name: Compile
33-
run: sbt -v compile
34-
- name: Test
35-
run: sbt -v test
21+
with:
22+
java-version: ${{ matrix.java }}
23+
java-opts: 'JAVA_OPTS=-Xmx5G --add-opens java.base/java.lang=ALL-UNNAMED'
3624

3725
publish:
38-
name: Publish release
39-
needs: [ci]
26+
uses: softwaremill/github-actions-workflows/.github/workflows/publish-release.yml@main
27+
needs: [build]
4028
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
41-
runs-on: ubuntu-22.04
42-
env:
43-
JAVA_OPTS: -Xmx5G
44-
steps:
45-
- name: Checkout
46-
uses: actions/checkout@v4
47-
- name: Set up JDK 17
48-
uses: actions/setup-java@v4
49-
with:
50-
distribution: 'zulu'
51-
java-version: '17'
52-
cache: 'sbt'
53-
- name: Compile
54-
run: sbt compile
55-
- name: Publish artifacts
56-
run: sbt ci-release
57-
env:
58-
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
59-
PGP_SECRET: ${{ secrets.PGP_SECRET }}
60-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
61-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
62-
- name: Extract version from commit message
63-
run: |
64-
version=${GITHUB_REF/refs\/tags\/v/}
65-
echo "VERSION=$version" >> $GITHUB_ENV
66-
env:
67-
COMMIT_MSG: ${{ github.event.head_commit.message }}
68-
- name: Publish release notes
69-
uses: release-drafter/release-drafter@v5
70-
with:
71-
config-name: release-drafter.yml
72-
publish: true
73-
name: "v${{ env.VERSION }}"
74-
tag: "v${{ env.VERSION }}"
75-
version: "v${{ env.VERSION }}"
76-
env:
77-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
secrets: inherit
30+
with:
31+
java-version: '17'
32+
java-opts: "-Xmx5G"
7833

79-
# `automerge` label is attached iff there is exactly one file changed by steward and this file belongs to a
80-
# whitelist specified by `labeler.yml`
8134
label:
82-
name: Attach automerge label
8335
# only for PRs by softwaremill-ci
8436
if: github.event.pull_request.user.login == 'softwaremill-ci'
85-
runs-on: ubuntu-22.04
86-
steps:
87-
- uses: actions/checkout@v4
88-
with:
89-
fetch-depth: 2
90-
# count number of files changed
91-
- name: Count number of files changed
92-
id: count-changed-files
93-
run: |
94-
N=$(git diff --name-only -r HEAD^1 HEAD | wc -w)
95-
echo "changed_files_num=$N" >> $GITHUB_OUTPUT
96-
- name: Launch labeler
97-
# skip if more than one file changed
98-
if: steps.count-changed-files.outputs.changed_files_num == 1
99-
uses: srvaroa/labeler@master
100-
env:
101-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
37+
uses: softwaremill/github-actions-workflows/.github/workflows/label.yml@main
10238

10339
auto-merge:
104-
name: Auto merge
10540
# only for PRs by softwaremill-ci
10641
if: github.event.pull_request.user.login == 'softwaremill-ci'
107-
needs: [ ci, label ]
108-
runs-on: ubuntu-22.04
109-
steps:
110-
- id: automerge
111-
name: automerge
112-
uses: "pascalgn/[email protected]"
113-
env:
114-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
115-
MERGE_METHOD: "squash"
42+
needs: [ build, label ]
43+
uses: softwaremill/github-actions-workflows/.github/workflows/auto-merge.yml@main

.github/workflows/scala-steward.yml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,8 @@ on:
88

99
jobs:
1010
scala-steward:
11-
runs-on: ubuntu-22.04
12-
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v4
15-
- name: Set up JDK 17
16-
uses: actions/setup-java@v4
17-
with:
18-
distribution: 'zulu'
19-
java-version: 17
20-
cache: 'sbt'
21-
- name: Launch Scala Steward
22-
uses: scala-steward-org/scala-steward-action@v2
23-
with:
24-
author-name: scala-steward
25-
author-email: scala-steward
26-
github-token: ${{ secrets.REPO_GITHUB_TOKEN }}
27-
repo-config: .scala-steward.conf
28-
ignore-opts-files: false
11+
uses: softwaremill/github-actions-workflows/.github/workflows/scala-steward.yml@main
12+
with:
13+
java-version: '17'
14+
secrets:
15+
repo-github-token: ${{secrets.REPO_GITHUB_TOKEN}}

0 commit comments

Comments
 (0)