aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/ci.yml27
1 files changed, 22 insertions, 5 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6b85d309..d4a328a4 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -31,17 +31,23 @@ jobs:
runtime: ["win-x64", "linux-x64", "linux-musl-x64", "linux-arm64", "osx-x64"]
steps:
- uses: actions/checkout@v2
+ - 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
- 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 $(echo $GITHUB_SHA | cut -c1-7)
-
+ run: bin/publish --no-prebuild --runtime ${{ matrix.runtime }} --version-suffix ${{ env.SHORT_SHA }}
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2
with:
- name: ${{ matrix.runtime }}
+ name: slskd-${{ env.APP_VERSION }}.${{ env.SHORT_SHA }}-${{ matrix.runtime }}
path: dist/${{ matrix.runtime }}
docker:
name: Build Docker Image
@@ -50,5 +56,16 @@ jobs:
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- - name: Build
- run: docker build -t slskd/slskd:$(echo $GITHUB_SHA | cut -c1-7) . \ No newline at end of file
+ - 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
+ - name: Docker Build
+ run: docker build -t slskd/slskd:${{ env.APP_VERSION }}.${{ env.SHORT_SHA }} .
+ - name: Login to Docker Hub
+ run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
+ - name: Docker Push SHA Tag
+ run: docker push slskd/slskd:${{ env.APP_VERSION }}.${{ env.SHORT_SHA }} \ No newline at end of file