Skip to content

Commit

Permalink
fix: main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
gnios committed Nov 20, 2024
1 parent 842b8c9 commit 01528ec
Showing 1 changed file with 37 additions and 11 deletions.
48 changes: 37 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,39 @@ jobs:
with:
dotnet-version: '8.x'

- name: Extract version number
id: extract_version
run: echo "##[set-output name=VERSION;]$(grep -oP '(?<=<Version>)[^<]+' Gnios.AzureDevops.Cli/Gnios.AzureDevops.Cli.csproj)"

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --configuration Release --no-restore

- name: Publish
run: dotnet publish --configuration Release --output ./publish --no-build
- name: Publish for Linux
run: dotnet publish --configuration Release --runtime linux-x64 --output ./publish/linux --no-build

- name: Publish for Windows
run: dotnet publish --configuration Release --runtime win-x64 --output ./publish/windows --no-build

- name: Create Linux release package
run: tar -czvf release-package-linux-${{ steps.extract_version.outputs.VERSION }}.tar.gz -C ./publish/linux .

- name: Create release package
run: tar -czvf release-package.tar.gz -C ./publish .
- name: Create Windows release package
run: tar -czvf release-package-windows-${{ steps.extract_version.outputs.VERSION }}.tar.gz -C ./publish/windows .

- name: Upload Linux release package
uses: actions/upload-artifact@v3
with:
name: release-package-linux-${{ steps.extract_version.outputs.VERSION }}
path: release-package-linux-${{ steps.extract_version.outputs.VERSION }}.tar.gz

- name: Upload release package
- name: Upload Windows release package
uses: actions/upload-artifact@v3
with:
name: release-package
path: release-package.tar.gz
name: release-package-windows-${{ steps.extract_version.outputs.VERSION }}
path: release-package-windows-${{ steps.extract_version.outputs.VERSION }}.tar.gz

- name: Create GitHub Release
id: create_release
Expand All @@ -45,16 +61,26 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
release_name: ${{ steps.extract_version.outputs.VERSION }}
draft: false
prerelease: false

- name: Upload Release Asset
- name: Upload Linux Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release-package-linux-${{ steps.extract_version.outputs.VERSION }}.tar.gz
asset_name: release-package-linux-${{ steps.extract_version.outputs.VERSION }}.tar.gz
asset_content_type: application/gzip

- name: Upload Windows Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release-package.tar.gz
asset_name: release-package.tar.gz
asset_path: ./release-package-windows-${{ steps.extract_version.outputs.VERSION }}.tar.gz
asset_name: release-package-windows-${{ steps.extract_version.outputs.VERSION }}.tar.gz
asset_content_type: application/gzip

0 comments on commit 01528ec

Please sign in to comment.