Skip to content

Commit 76796d9

Browse files
committed
Fix workflow for publishing binary to a release
1 parent 50ee5cc commit 76796d9

File tree

3 files changed

+57
-57
lines changed

3 files changed

+57
-57
lines changed

.github/workflows/build.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
name: Build
3+
4+
on:
5+
push:
6+
branches: [ "master" ]
7+
pull_request:
8+
branches: [ "master" ]
9+
10+
env:
11+
SOLUTION_FILE_PATH: .
12+
BUILD_CONFIGURATION: Release
13+
PLATFORM: x86
14+
15+
permissions:
16+
contents: write
17+
actions: read
18+
19+
jobs:
20+
build:
21+
runs-on: windows-latest
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Decide version
27+
shell: bash
28+
run: echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
29+
30+
- name: Add MSBuild to PATH
31+
uses: microsoft/setup-msbuild@v1.0.2
32+
33+
- name: Build
34+
working-directory: ${{env.GITHUB_WORKSPACE}}
35+
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:PluginVersion="${{env.VERSION}}" /p:Contributors="TBD" ${{env.SOLUTION_FILE_PATH}} /p:Platform=${{env.PLATFORM}}
36+
37+
- name: Upload Build Artifacts
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: ILS_Window_Plugin-${{ env.VERSION }}
41+
path: |
42+
Release/*.dll
43+
Release/*.json
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
name: Build artifacts
1+
2+
name: Publish
23

34
on:
45
push:
5-
branches: [ "master" ]
6-
pull_request:
7-
branches: [ "master" ]
8-
workflow_dispatch:
9-
inputs:
10-
build_target:
11-
description: "Target branch or tag to build"
12-
required: false
13-
default: "master"
6+
tags:
7+
- '*'
148

159
env:
1610
SOLUTION_FILE_PATH: .
@@ -28,38 +22,30 @@ jobs:
2822

2923
steps:
3024
- uses: actions/checkout@v4
31-
with:
32-
fetch-depth: 0
3325

3426
- name: Decide version
3527
shell: bash
36-
run: |
37-
LATEST_TAG=$(git describe --tags --abbrev=0)
38-
CURRENT_SHA=$(git rev-parse --short HEAD)
39-
if [[ $(git rev-list $LATEST_TAG..HEAD --count) -gt 0 ]]; then
40-
VERSION="${LATEST_TAG}-${CURRENT_SHA}"
41-
else
42-
VERSION="${LATEST_TAG}"
43-
fi
44-
echo "VERSION=$VERSION" >> $GITHUB_ENV
28+
run: echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
4529

4630
- name: Get Repository Contributors
4731
shell: bash
4832
run: |
4933
CONTRIBUTORS=$(curl "https://api.github.com/repos/${{ github.repository }}/contributors?per_page=100" | jq -r '.[].login' | paste -sd, -)
5034
echo "CONTRIBUTORS=$CONTRIBUTORS" >> $GITHUB_ENV
51-
35+
5236
- name: Add MSBuild to PATH
5337
uses: microsoft/setup-msbuild@v1.0.2
5438

5539
- name: Build
5640
working-directory: ${{env.GITHUB_WORKSPACE}}
5741
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:PluginVersion="${{env.VERSION}}" /p:Contributors="${{env.CONTRIBUTORS}}" ${{env.SOLUTION_FILE_PATH}} /p:Platform=${{env.PLATFORM}}
5842

59-
- name: Upload Build Artifacts
60-
uses: actions/upload-artifact@v4
43+
- name: Zip the build artifacts
44+
run: |
45+
powershell -Command Compress-Archive -Path "Release\*.json","Release\*.dll" -DestinationPath ILS_Window_Plugin-${{ env.VERSION }}.zip
46+
47+
- name: Upload binaries to release
48+
uses: svenstaro/upload-release-action@v2
6149
with:
62-
name: ILS_Window_Plugin-${{ env.VERSION }}
63-
path: |
64-
Release/*.dll
65-
Release/*.json
50+
file: ILS_Window_Plugin-${{ env.VERSION }}.zip
51+
tag: ${{ github.ref }}

.github/workflows/upload-release.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)