Skip to content
Merged
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
41 changes: 28 additions & 13 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
include:
- os: windows-latest
rid: win-x64
archive_name: SelectSight-Windows-x64.zip
publish_dir: publish/win-x64
- os: ubuntu-latest
rid: linux-x64
archive_name: SelectSight-Linux-x64.tar.gz
publish_dir: publish/linux-x64
outputs:
app_version: ${{ steps.generate_version.outputs.generated_version }}

steps:
- name: Checkout Repository
Expand All @@ -38,25 +38,39 @@ jobs:
- name: Restore Dependencies
run: dotnet restore

- name: Generate Version Number
id: generate_version
shell: bash
run: |
VERSION_NUMBER="${{ vars.MAJOR_VERSION }}.${{ vars.MINOR_VERSION }}.${{ github.run_number }}"
echo "Generated version: $VERSION_NUMBER"
echo "generated_version=$VERSION_NUMBER" >> "$GITHUB_OUTPUT"

- name: Build and Publish for ${{ matrix.rid }}
run: dotnet publish ./SelectSight.csproj --configuration Release --no-restore --runtime ${{ matrix.rid }} --self-contained true -p:PublishSingleFile=true -p:DebugType=None -o ./publish/${{ matrix.rid }}
run: dotnet publish ./SelectSight.csproj --configuration Release --no-restore --runtime ${{ matrix.rid }} --self-contained true -p:PublishSingleFile=true -p:DebugType=None -o ./publish/${{ matrix.rid }} -p:Version=${{ steps.generate_version.outputs.generated_version }}


- name: Archive published output (Windows)
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: Compress-Archive -Path ${{ matrix.publish_dir }}/* -DestinationPath ${{ matrix.archive_name }}
run: |
$ArchiveName = "SelectSight-Windows-x64-${{ steps.generate_version.outputs.generated_version }}.zip"
Compress-Archive -Path ${{ matrix.publish_dir }}/* -DestinationPath $ArchiveName
echo "archive_name=$ArchiveName" >> $env:GITHUB_ENV

- name: Archive published output (Linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
shell: bash
run: tar -czvf ${{ matrix.archive_name }} -C ${{ matrix.publish_dir }} .
run: |
ARCHIVE_NAME="SelectSight-Linux-x64-${{ steps.generate_version.outputs.generated_version }}.tar.gz"
tar -czvf "$ARCHIVE_NAME" -C ${{ matrix.publish_dir }} .
echo "archive_name=$ARCHIVE_NAME" >> "$GITHUB_ENV"

- name: Upload Archived Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.archive_name }}
path: ./${{ matrix.archive_name }}
name: ${{ env.archive_name }}
path: ./${{ env.archive_name }}
retention-days: 1


Expand All @@ -76,15 +90,16 @@ jobs:
path: ./release_assets

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2 # Action to create a GitHub Release
with:
tag_name: v${{ github.run_number }}-${{ github.run_id }} # Example: v123-456789
name: Release ${{ github.run_number }} (${{ github.run_id }})
body: Automated build for SelectSight
tag_name: v${{ needs.build.outputs.app_version }}
name: Release v${{ needs.build.outputs.app_version }}
body: |
Automated build for SelectSight
Version: ${{ needs.build.outputs.app_version }}
draft: true
files: |
./release_assets/SelectSight-Windows-x64.zip/SelectSight-Windows-x64.zip
./release_assets/SelectSight-Linux-x64.tar.gz/SelectSight-Linux-x64.tar.gz
./release_assets/SelectSight-Windows-x64-${{ needs.build.outputs.app_version }}.zip/SelectSight-Windows-x64-${{ needs.build.outputs.app_version }}.zip
./release_assets/SelectSight-Linux-x64-${{ needs.build.outputs.app_version }}.tar.gz/SelectSight-Linux-x64-${{ needs.build.outputs.app_version }}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}