aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml36
-rwxr-xr-xbin/build12
-rwxr-xr-xbin/publish12
-rw-r--r--src/slskd/slskd.csproj2
4 files changed, 35 insertions, 27 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 890c8ebb..2fdf2b1b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -12,10 +12,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+ - name: Set Environment Variables
+ run: |
+ echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
+ echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Web
run: ./bin/build --web-only
- name: Dotnet
- run: ./bin/build --dotnet-only
+ run: ./bin/build --dotnet-only --version ${{ env.LATEST_TAG }}-${{ env.SHORT_SHA }}
- name: Upload Static Web Content
uses: actions/upload-artifact@v2
with:
@@ -31,23 +37,22 @@ jobs:
runtime: ["win-x64", "linux-x64", "linux-musl-x64", "linux-arm64", "osx-x64"]
steps:
- uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
- name: Set Environment Variables
run: |
- echo "SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
- csproj=$(cat src/slskd/slskd.csproj)
- pattern='<VersionPrefix>(.*)<\/VersionPrefix>'
- [[ "$csproj" =~ $pattern ]]
- echo "APP_VERSION=${BASH_REMATCH[1]}" >> $GITHUB_ENV
+ echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
+ echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/download-artifact@v2
with:
name: web
path: src/slskd/wwwroot
- name: Publish ${{ matrix.runtime }}
- run: bin/publish --no-prebuild --runtime ${{ matrix.runtime }} --version-suffix ${{ env.SHORT_SHA }}
+ run: bin/publish --no-prebuild --runtime ${{ matrix.runtime }} --version ${{ env.LATEST_TAG }}-${{ env.SHORT_SHA }}
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2
with:
- name: slskd-${{ env.APP_VERSION }}.${{ env.SHORT_SHA }}-${{ matrix.runtime }}
+ name: slskd-${{ env.LATEST_TAG }}.${{ env.SHORT_SHA }}-${{ matrix.runtime }}
path: dist/${{ matrix.runtime }}
docker:
name: Build Docker Image
@@ -56,20 +61,19 @@ jobs:
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
- name: Set Environment Variables
run: |
- echo "SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
- csproj=$(cat src/slskd/slskd.csproj)
- pattern='<VersionPrefix>(.*)<\/VersionPrefix>'
- [[ "$csproj" =~ $pattern ]]
- echo "APP_VERSION=${BASH_REMATCH[1]}" >> $GITHUB_ENV
+ echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
+ echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build
- run: docker build -t slskd/slskd:${{ env.APP_VERSION }}.${{ env.SHORT_SHA }} .
+ run: docker build -t slskd/slskd:${{ env.LATEST_TAG }}.${{ env.SHORT_SHA }} .
- name: Tag (Nightly)
- run: docker tag slskd/slskd:${{ env.APP_VERSION }}.${{ env.SHORT_SHA }} slskd/slskd:Nightly
+ run: docker tag slskd/slskd:${{ env.LATEST_TAG }}.${{ env.SHORT_SHA }} slskd/slskd:Nightly
- name: Login
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Push
run: |
- docker push slskd/slskd:${{ env.APP_VERSION }}.${{ env.SHORT_SHA }}
+ docker push slskd/slskd:${{ env.LATEST_TAG }}.${{ env.SHORT_SHA }}
docker push slskd/slskd:nightly \ No newline at end of file
diff --git a/bin/build b/bin/build
index 23b09171..7c76b824 100755
--- a/bin/build
+++ b/bin/build
@@ -4,7 +4,9 @@ set -e
web_only=false
dotnet_only=false
skip_tests=false
-version_suffix=$(git rev-parse --short HEAD)
+tag=$(git describe --tags)
+sha=$(git rev-parse --short HEAD)
+version=$tag-$sha
while test $# -gt 0; do
case "$1" in
@@ -29,9 +31,9 @@ while test $# -gt 0; do
skip_tests=true
shift
;;
- --version-suffix)
+ --version)
shift
- version_suffix=$1
+ version=$1
shift
;;
*)
@@ -83,8 +85,8 @@ else
echo $'\n> pwd\n'
pwd
- echo $'\n> dotnet build --no-incremental --nologo --configuration Release\n'
- dotnet build --no-incremental --nologo --configuration Release --version-suffix $version_suffix
+ echo $'\n> dotnet build --no-incremental --nologo --configuration Release -p:Version '$version$'\n'
+ dotnet build --no-incremental --nologo --configuration Release -p:Version=$version
if [ "$skip_tests" == true ]; then
echo $'\ndotnet tests skipped\n'
diff --git a/bin/publish b/bin/publish
index 57623a7a..5106af53 100755
--- a/bin/publish
+++ b/bin/publish
@@ -2,7 +2,9 @@
set -e
build=true
-version_suffix=$(git rev-parse --short HEAD)
+tag=$(git describe --tags)
+sha=$(git rev-parse --short HEAD)
+version=$tag-$sha
while test $# -gt 0; do
case "$1" in
@@ -23,9 +25,9 @@ while test $# -gt 0; do
runtime=$1
shift
;;
- --version-suffix)
+ --version)
shift
- version_suffix=$1
+ version=$1
shift
;;
*)
@@ -50,7 +52,7 @@ cd src/slskd
echo $'\n> pwd\n'
pwd
-echo $'\n> dotnet publish ... --runtime '$runtime$' --version-suffix '$version_suffix$'\n'
+echo $'\n> dotnet publish ... --runtime '$runtime$' -p:Version '$version$'\n'
rm -rf dist/$runtime/*
dotnet publish \
--configuration Release \
@@ -59,8 +61,8 @@ dotnet publish \
-p:PublishTrimmed=true \
-p:IncludeNativeLibrariesForSelfExtract=true \
-p:CopyOutputSymbolsToPublishDirectory=false \
+ -p:Version=$version \
--self-contained \
- --version-suffix $version_suffix \
--runtime $runtime \
--output ../../dist/$runtime
diff --git a/src/slskd/slskd.csproj b/src/slskd/slskd.csproj
index 3415ba18..6c243343 100644
--- a/src/slskd/slskd.csproj
+++ b/src/slskd/slskd.csproj
@@ -7,7 +7,6 @@
<PropertyGroup>
<ServerGarbageCollection>false</ServerGarbageCollection>
- <VersionPrefix>0.9.1</VersionPrefix>
<RepositoryUrl>https://github.com/slskd/slskd</RepositoryUrl>
<PackageProjectUrl>https://slskd.org</PackageProjectUrl>
<Authors>slskd Team</Authors>
@@ -48,6 +47,7 @@
<None Include="..\..\LICENSE">
<Pack>True</Pack>
<PackagePath></PackagePath>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>