Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add builds for all distributions #41

Merged
merged 8 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Git Mkver Build

# Trigger on every master branch push and pull request
on:
push:
branches:
- master
- patch-*
pull_request:
branches:
- master

jobs:
build-on-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '20'
cache: 'sbt'
- uses: graalvm/setup-graalvm@v1
with:
distribution: 'graalvm'
java-version: '20'
components: 'native-image'
# github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Build
run: .\build-windows.ps1
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: git-mkver-windows
path: target\scala-2.12\git-mkver-windows-amd64-*.zip
build-on-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '20'
cache: 'sbt'
- uses: graalvm/setup-graalvm@v1
with:
distribution: 'graalvm'
java-version: '20'
components: 'native-image'
# github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Build
run: ./build-linux.sh
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: git-mkver-linux
path: target/git-mkver-linux-*.tar.gz
build-universal:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '20'
cache: 'sbt'
- name: Build
run: ./build-universal.sh
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: git-mkver-universal
path: target/universal/git-mkver-*.zip
build-on-mac-x64:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '20'
cache: 'sbt'
- uses: graalvm/setup-graalvm@v1
with:
distribution: 'graalvm'
java-version: '20'
components: 'native-image'
# github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Build
run: ./build-macos.sh
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: git-mkver-darwin
path: target/git-mkver-darwin-*.tar.gz
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
target/
.idea/
_site/
.bsp/
20 changes: 20 additions & 0 deletions build-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
set -e

sbt -error -batch "run -c git-mkver.conf patch"
version=`sbt -error -batch "run -c git-mkver.conf next"`
arch=`arch`

sbt assembly

pushd target
native-image --static -H:IncludeResources='.*conf$' --no-fallback -jar scala-2.12/git-mkver-assembly-$version.jar
mv git-mkver-assembly-$version git-mkver-linux-$arch-$version
cp git-mkver-linux-$arch-$version git-mkver
chmod +x git-mkver
tar -cvzf git-mkver-linux-$arch-$version.tar.gz git-mkver
rm git-mkver
popd

LINUX_SHA256=$(openssl dgst -sha256 target/git-mkver-linux-$arch-$version.tar.gz | cut -f2 -d' ')
echo "LINUX_SHA256=$LINUX_SHA256"
20 changes: 20 additions & 0 deletions build-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
set -e

sbt -error -batch "run -c git-mkver.conf patch"
version=`sbt -error -batch "run -c git-mkver.conf next"`
arch=`arch`

sbt assembly

pushd target
native-image -H:IncludeResources='.*conf$' --no-fallback -jar scala-2.12/git-mkver-assembly-$version.jar
mv git-mkver-assembly-$version git-mkver-darwin-$arch-$version
cp git-mkver-darwin-$arch-$version git-mkver
chmod +x git-mkver
tar -cvzf git-mkver-darwin-$arch-$version.tar.gz git-mkver
rm git-mkver
popd

DARWIN_SHA256=$(openssl dgst -sha256 target/git-mkver-darwin-$arch-$version.tar.gz | cut -f2 -d' ')
echo "DARWIN_SHA256=$DARWIN_SHA256"
13 changes: 13 additions & 0 deletions build-universal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -e

sbt -error -batch "run -c git-mkver.conf patch"
version=`sbt -error -batch "run -c git-mkver.conf next"`
arch=`arch`

sbt assembly

# build universal
sbt universal:packageBin
UNIVERSAL_SHA256=$(openssl dgst -sha256 target/universal/git-mkver-$version.zip | cut -f2 -d' ')
echo "UNIVERSAL_SHA256=$UNIVERSAL_SHA256"
12 changes: 12 additions & 0 deletions build-windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# & "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd"

# Get the version from the git command
& sbt -error -batch "run -c git-mkver.conf patch"
$VERSION = & sbt -error -batch "run -c git-mkver.conf next"

& sbt assembly
Set-Location -Path target\scala-2.12
& native-image -jar "git-mkver-assembly-$VERSION.jar" --no-fallback
Move-Item -Path "git-mkver-assembly-$VERSION.exe" -Destination git-mkver.exe
Compress-Archive -Path 'git-mkver.exe' -DestinationPath 'git-mkver-windows-amd64-%VERSION%.zip'
Get-FileHash git-mkver-windows-amd64-%VERSION%.zip | % Hash
10 changes: 0 additions & 10 deletions build.cmd

This file was deleted.

2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Dependencies._

scalaVersion := "2.12.11"
version := "1.3.0"
version := "1.4.0+ci-build.2fd9c7f"
organization := "net.cardnell"
maintainer := "[email protected]"

Expand Down
46 changes: 0 additions & 46 deletions build.sh

This file was deleted.

2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Linux

```bash
curl -L https://github.com/idc101/git-mkver/releases/download/v1.3.0/git-mkver-linux-x86_64-1.3.0.tar.gz | tar xvz
curl -L https://github.com/idc101/git-mkver/releases/download/v1.4.0/git-mkver-linux-x86_64-1.4.0.tar.gz | tar xvz
sudo mv git-mkver /usr/local/bin
```

Expand Down
4 changes: 2 additions & 2 deletions etc/scoop/git-mkver.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "1.3.0",
"version": "1.4.0",
"description": "Automatic Semantic Versioning for git based software development",
"url": "https://github.com/idc101/git-mkver/releases/download/v1.3.0/git-mkver-windows-amd64-1.3.0.zip",
"url": "https://github.com/idc101/git-mkver/releases/download/v1.4.0/git-mkver-windows-amd64-1.4.0.zip",
"hash": "63AD6FD8EBB1E27F2CB81B7C162CB2D0A66809C4C693402D2EC9F1496C9A2636",
"extract_to": "",
"bin": "git-mkver.exe"
Expand Down
2 changes: 1 addition & 1 deletion etc/shell/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/bin/bash
MKVER_VERSION=1.3.0
MKVER_VERSION=1.4.0

# Mac
if [[ "$(uname)" == "Darwin" ]]
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/net/cardnell/mkver/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import zio.Has
package object mkver {
type Git = Has[Git.Service]

val GitMkverVersion = "1.3.0"
val GitMkverVersion = "1.4.0"
}
Loading