Skip to content

Commit

Permalink
updated release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
nikololiahim committed May 13, 2022
1 parent cedd47e commit d47b8b6
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 38 deletions.
99 changes: 78 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
name: Release

on:
workflow_dispatch:
inputs:
release_version:
description: Release version
required: false
default: ''
on: workflow_dispatch

jobs:
release:
name: Release
pre-release:
runs-on: ubuntu-latest
outputs:
release-tag: ${{ steps.latest-tag.outputs.tag }}
steps:
- name: Check out repository code
uses: actions/checkout@v2
Expand All @@ -23,25 +18,87 @@ jobs:
distribution: 'temurin'
java-version: '11'
- name: Configure local git
run: |
git config user.name "${{ secrets.GIT_USERNAME }}"
run: >-
git config user.name "${{ secrets.GIT_USERNAME }}" &&
git config user.email "${{ secrets.GIT_USER_EMAIL }}"
- name: Release new version
if: ${{ github.event.inputs.release_version == '' }}
run: |
sbt "release with-defaults"
- name: Release the specified version
if: ${{ github.event.inputs.release_version != '' }}
run: |
sbt "release with-defaults release-version ${{ github.event.inputs.release_version }}"
run: sbt preRelease
- name: Latest tag
uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
id: latest-tag
- name: Github Release
id: gh_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.get-latest-tag.outputs.tag }}
tag_name: ${{ steps.latest-tag.outputs.tag }}
body_path: CHANGELOG.md
files: |
target/scala-3.1.2/polystat.jar
polystat-x86_64-pc-linux
build-binaries:
needs: pre-release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
uploaded_filename: polystat-x86_64-pc-linux
local_path: polystat
- os: windows-latest
uploaded_filename: polystat-x86_64-pc-win32.exe
local_path: polystat.exe
steps:
- name: Check out repository code
uses: actions/checkout@v2
with:
token: ${{ secrets.GIT_TOKEN }}
- name: Configure local git
run: >-
git config user.name "${{ secrets.GIT_USERNAME }}" &&
git config user.email "${{ secrets.GIT_USER_EMAIL }}"
- run: git pull --no-rebase
- uses: olafurpg/setup-scala@v13
- name: Set up Visual Studio shell
uses: egor-tensin/vs-shell@v2
if: ${{ matrix.os == 'windows-latest' }}
- name: build native image (windows)
if: ${{ matrix.os == 'windows-latest' }}
shell: cmd
run: >-
echo %PATH% &&
sbt nativeImage &&
copy target\native-image\polystat-cli.exe ${{ matrix.uploaded_filename }} &&
tree
- name: build native image (linux)
if: ${{ matrix.os != 'windows-latest' }}
shell: bash
run: |
echo $PATH
sbt "nativeImageCopy ${{ matrix.uploaded_filename }}" nativeImageRun
- name: Upload release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.pre-release.outputs.release-tag }}
files: ${{ matrix.uploaded_filename }}
post-release:
needs: build-binaries
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
with:
token: ${{ secrets.GIT_TOKEN }}
- name: Configure local git
run: |
git config user.name "${{ secrets.GIT_USERNAME }}"
git config user.email "${{ secrets.GIT_USER_EMAIL }}"
- name: setup JDK
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
- run: git pull --no-rebase
- name: Run post-release steps
run: |
sbt postRelease
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## Polystat v0.1.1
## Polystat v0.1.2

In this release, the CI was updated to produce native Linux binaries using GraalVM Native Image.
In this release, the CI was updated to produce native binaries for Windows and Linux.
57 changes: 42 additions & 15 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,55 @@ nativeImageOptions ++= Seq(
"--initialize-at-run-time=scala.tools.nsc.ast.parser.ParsersCommon",
"--static",
"--no-fallback",
"--enable-http",
"--enable-https",
"--verbose",
)

scalacOptions ++= Seq(
"-Wunused:all"
)

releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepTask(assembly),
releaseStepInputTask(nativeImageCopy, "polystat-x86_64-pc-linux"),
releaseStepInputTask(nativeImageRun),
setNextVersion,
commitNextVersion,
pushChanges,
)
commands += Command.command("preRelease") { state =>
val newState = Project
.extract(state)
.appendWithSession(
Seq(
releaseProcess := Seq(
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
releaseStepTask(assembly),
commitReleaseVersion,
tagRelease,
pushChanges,
)
),
state,
)

Command.process("release with-defaults", newState)
}

commands += Command.command("postRelease") { state =>
val newState = Project
.extract(state)
.appendWithSession(
Seq(
releaseProcess := Seq(
inquireVersions,
setNextVersion,
commitNextVersion,
pushChanges,
)
),
state,
)

Command.process("release with-defaults", newState)
}

val githubWorkflowScalas = List("3.1.2")

Expand Down

0 comments on commit d47b8b6

Please sign in to comment.