Skip to content

Commit

Permalink
Update dotnet.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
oscar-wos authored Jun 1, 2024
1 parent 6aa5d7a commit 44a26d9
Showing 1 changed file with 30 additions and 15 deletions.
45 changes: 30 additions & 15 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

Expand All @@ -33,13 +33,14 @@ jobs:
release:
needs: build
runs-on: ubuntu-latest
permissions: write-all

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

Expand All @@ -49,30 +50,44 @@ jobs:
- name: Build
run: dotnet build -c Release

- name: Publish
run: dotnet publish -c Release --output ./publish

- name: Create Directories
run: |
mkdir -p plugin/plugins/Sessions
mkdir -p plugin/shared/Sessions
mkdir -p plugin/shared/Sessions.API
mv ./src/bin/Release/net8.0/* ./plugin/plugins/Sessions
mv ./Sessions.API/bin/Release/* ./plugin/shared/Sessions
mv ./Sessions.API/bin/Release/net8.0/* ./plugin/shared/Sessions.API
rm ./plugin/plugins/Sessions/Sessions.API.*
- name: Zip
run: zip -r Sessions.zip ./plugin
run: |
cd plugin/
zip -r Sessions-${{ github.sha }}.zip .
- name: Extract version and create tag
id: extract_version
run: |
version=$(grep -oP 'public override string ModuleVersion => "\K(.*)(?=";)' ./src/Globals.cs)
echo "Version found: $version"
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
git tag $version
git push origin $version
echo "::set-output name=version::$version"
- name: Publish
uses: actions/upload-artifact@v4
with:
name: Sessions.zip
name: Sessions-${{ github.sha }}
path: plugin

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
tag_name: ${{ steps.extract_version.outputs.version }}
release_name: ${{ steps.extract_version.outputs.version }}
body: |
This is an automated release.
draft: false
Expand All @@ -85,6 +100,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./
asset_path: ./plugin/Sessions-${{ github.sha }}.zip
asset_name: Sessions.zip
asset_content_type: application/zip
asset_content_type: application/zip

0 comments on commit 44a26d9

Please sign in to comment.