Skip to content

Commit d47b8b6

Browse files
committed
updated release pipeline
1 parent cedd47e commit d47b8b6

File tree

3 files changed

+122
-38
lines changed

3 files changed

+122
-38
lines changed

.github/workflows/release.yml

Lines changed: 78 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
name: Release
22

3-
on:
4-
workflow_dispatch:
5-
inputs:
6-
release_version:
7-
description: Release version
8-
required: false
9-
default: ''
3+
on: workflow_dispatch
104

115
jobs:
12-
release:
13-
name: Release
6+
pre-release:
147
runs-on: ubuntu-latest
8+
outputs:
9+
release-tag: ${{ steps.latest-tag.outputs.tag }}
1510
steps:
1611
- name: Check out repository code
1712
uses: actions/checkout@v2
@@ -23,25 +18,87 @@ jobs:
2318
distribution: 'temurin'
2419
java-version: '11'
2520
- name: Configure local git
26-
run: |
27-
git config user.name "${{ secrets.GIT_USERNAME }}"
21+
run: >-
22+
git config user.name "${{ secrets.GIT_USERNAME }}" &&
2823
git config user.email "${{ secrets.GIT_USER_EMAIL }}"
2924
- name: Release new version
30-
if: ${{ github.event.inputs.release_version == '' }}
31-
run: |
32-
sbt "release with-defaults"
33-
- name: Release the specified version
34-
if: ${{ github.event.inputs.release_version != '' }}
35-
run: |
36-
sbt "release with-defaults release-version ${{ github.event.inputs.release_version }}"
25+
run: sbt preRelease
3726
- name: Latest tag
3827
uses: actions-ecosystem/action-get-latest-tag@v1
39-
id: get-latest-tag
28+
id: latest-tag
4029
- name: Github Release
30+
id: gh_release
4131
uses: softprops/action-gh-release@v1
4232
with:
43-
tag_name: ${{ steps.get-latest-tag.outputs.tag }}
33+
tag_name: ${{ steps.latest-tag.outputs.tag }}
4434
body_path: CHANGELOG.md
4535
files: |
4636
target/scala-3.1.2/polystat.jar
47-
polystat-x86_64-pc-linux
37+
build-binaries:
38+
needs: pre-release
39+
runs-on: ${{ matrix.os }}
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
os: [ubuntu-latest, windows-latest]
44+
include:
45+
- os: ubuntu-latest
46+
uploaded_filename: polystat-x86_64-pc-linux
47+
local_path: polystat
48+
- os: windows-latest
49+
uploaded_filename: polystat-x86_64-pc-win32.exe
50+
local_path: polystat.exe
51+
steps:
52+
- name: Check out repository code
53+
uses: actions/checkout@v2
54+
with:
55+
token: ${{ secrets.GIT_TOKEN }}
56+
- name: Configure local git
57+
run: >-
58+
git config user.name "${{ secrets.GIT_USERNAME }}" &&
59+
git config user.email "${{ secrets.GIT_USER_EMAIL }}"
60+
- run: git pull --no-rebase
61+
- uses: olafurpg/setup-scala@v13
62+
- name: Set up Visual Studio shell
63+
uses: egor-tensin/vs-shell@v2
64+
if: ${{ matrix.os == 'windows-latest' }}
65+
- name: build native image (windows)
66+
if: ${{ matrix.os == 'windows-latest' }}
67+
shell: cmd
68+
run: >-
69+
echo %PATH% &&
70+
sbt nativeImage &&
71+
copy target\native-image\polystat-cli.exe ${{ matrix.uploaded_filename }} &&
72+
tree
73+
- name: build native image (linux)
74+
if: ${{ matrix.os != 'windows-latest' }}
75+
shell: bash
76+
run: |
77+
echo $PATH
78+
sbt "nativeImageCopy ${{ matrix.uploaded_filename }}" nativeImageRun
79+
- name: Upload release
80+
uses: softprops/action-gh-release@v1
81+
with:
82+
tag_name: ${{ needs.pre-release.outputs.release-tag }}
83+
files: ${{ matrix.uploaded_filename }}
84+
post-release:
85+
needs: build-binaries
86+
runs-on: ubuntu-latest
87+
steps:
88+
- name: Check out repository code
89+
uses: actions/checkout@v2
90+
with:
91+
token: ${{ secrets.GIT_TOKEN }}
92+
- name: Configure local git
93+
run: |
94+
git config user.name "${{ secrets.GIT_USERNAME }}"
95+
git config user.email "${{ secrets.GIT_USER_EMAIL }}"
96+
- name: setup JDK
97+
uses: actions/setup-java@v2
98+
with:
99+
distribution: 'temurin'
100+
java-version: '11'
101+
- run: git pull --no-rebase
102+
- name: Run post-release steps
103+
run: |
104+
sbt postRelease

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
## Polystat v0.1.1
1+
## Polystat v0.1.2
22

3-
In this release, the CI was updated to produce native Linux binaries using GraalVM Native Image.
3+
In this release, the CI was updated to produce native binaries for Windows and Linux.

build.sbt

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,55 @@ nativeImageOptions ++= Seq(
4848
"--initialize-at-run-time=scala.tools.nsc.ast.parser.ParsersCommon",
4949
"--static",
5050
"--no-fallback",
51+
"--enable-http",
52+
"--enable-https",
5153
"--verbose",
5254
)
5355

5456
scalacOptions ++= Seq(
5557
"-Wunused:all"
5658
)
5759

58-
releaseProcess := Seq[ReleaseStep](
59-
checkSnapshotDependencies,
60-
inquireVersions,
61-
runClean,
62-
runTest,
63-
setReleaseVersion,
64-
commitReleaseVersion,
65-
tagRelease,
66-
releaseStepTask(assembly),
67-
releaseStepInputTask(nativeImageCopy, "polystat-x86_64-pc-linux"),
68-
releaseStepInputTask(nativeImageRun),
69-
setNextVersion,
70-
commitNextVersion,
71-
pushChanges,
72-
)
60+
commands += Command.command("preRelease") { state =>
61+
val newState = Project
62+
.extract(state)
63+
.appendWithSession(
64+
Seq(
65+
releaseProcess := Seq(
66+
checkSnapshotDependencies,
67+
inquireVersions,
68+
runClean,
69+
runTest,
70+
setReleaseVersion,
71+
releaseStepTask(assembly),
72+
commitReleaseVersion,
73+
tagRelease,
74+
pushChanges,
75+
)
76+
),
77+
state,
78+
)
79+
80+
Command.process("release with-defaults", newState)
81+
}
82+
83+
commands += Command.command("postRelease") { state =>
84+
val newState = Project
85+
.extract(state)
86+
.appendWithSession(
87+
Seq(
88+
releaseProcess := Seq(
89+
inquireVersions,
90+
setNextVersion,
91+
commitNextVersion,
92+
pushChanges,
93+
)
94+
),
95+
state,
96+
)
97+
98+
Command.process("release with-defaults", newState)
99+
}
73100

74101
val githubWorkflowScalas = List("3.1.2")
75102

0 commit comments

Comments
 (0)