Skip to content

Commit

Permalink
Fix workflow for publishing binary to a release
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenAR committed Jan 6, 2025
1 parent 50ee5cc commit 76796d9
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 57 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

name: Build

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
SOLUTION_FILE_PATH: .
BUILD_CONFIGURATION: Release
PLATFORM: x86

permissions:
contents: write
actions: read

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Decide version
shell: bash
run: echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.2

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

- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: ILS_Window_Plugin-${{ env.VERSION }}
path: |
Release/*.dll
Release/*.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
name: Build artifacts

name: Publish

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
inputs:
build_target:
description: "Target branch or tag to build"
required: false
default: "master"
tags:
- '*'

env:
SOLUTION_FILE_PATH: .
Expand All @@ -28,38 +22,30 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Decide version
shell: bash
run: |
LATEST_TAG=$(git describe --tags --abbrev=0)
CURRENT_SHA=$(git rev-parse --short HEAD)
if [[ $(git rev-list $LATEST_TAG..HEAD --count) -gt 0 ]]; then
VERSION="${LATEST_TAG}-${CURRENT_SHA}"
else
VERSION="${LATEST_TAG}"
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
run: echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV

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

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

- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
- name: Zip the build artifacts
run: |
powershell -Command Compress-Archive -Path "Release\*.json","Release\*.dll" -DestinationPath ILS_Window_Plugin-${{ env.VERSION }}.zip
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
name: ILS_Window_Plugin-${{ env.VERSION }}
path: |
Release/*.dll
Release/*.json
file: ILS_Window_Plugin-${{ env.VERSION }}.zip
tag: ${{ github.ref }}
29 changes: 0 additions & 29 deletions .github/workflows/upload-release.yaml

This file was deleted.

0 comments on commit 76796d9

Please sign in to comment.