-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c93727c
commit 7af4306
Showing
1 changed file
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: Create release | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- master | ||
types: | ||
- closed | ||
|
||
jobs: | ||
build: | ||
name: Generate dll | ||
runs-on: windows-latest | ||
outputs: | ||
name: ${{ steps.version.outputs.name }} | ||
version: ${{ steps.version.outputs.version }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Setup MSBuild.exe | ||
uses: microsoft/[email protected] | ||
- name: Setup Nuget | ||
uses: NuGet/[email protected] | ||
- name: Restore nuget packages | ||
run: nuget restore AtsExCsTemplate.sln | ||
- name: Build sln | ||
run: msbuild AtsExCsTemplate.sln /m /p:configuration="Release" /p:platform="Any CPU" /p:OutputPath="./out/" | ||
shell: cmd | ||
- name: Collect artifact | ||
run: | | ||
mkdir plugins/ | ||
find . -type f -path '*/out/*.dll' | xargs mv -t ./plugins/ | ||
shell: bash | ||
- name: Check assembly version | ||
id: version | ||
run: | | ||
Get-ChildItem plugins/ -Recurse -Filter "*.dll" -File | foreach { | ||
Write-Output $_.FileName | ||
$_.FileName | ||
"name=$_" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | ||
$ver=(Get-Item $_.FullName).VersionInfo.FileVersion | ||
$ver | ||
"version=v$ver" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | ||
} | ||
shell: pwsh | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: plugins | ||
path: ./plugins/ | ||
|
||
release: | ||
name: Create release | ||
runs-on: ubuntu-latest | ||
needs: build | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Create tag | ||
run: | | ||
git tag ${{needs.build.outputs.version}} | ||
git push origin ${{needs.build.outputs.version}} | ||
- name: Create release draft | ||
id: create-draft | ||
uses: release-drafter/[email protected] | ||
with: | ||
version: ${{needs.build.outputs.version}} | ||
name: ${{needs.build.outputs.version}} | ||
tag: ${{needs.build.outputs.version}} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Download a build artifact | ||
uses: actions/[email protected] | ||
- name: Get repository name | ||
run: | | ||
echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/}" >> $GITHUB_ENV | ||
echo "FILE_NAME=${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/}_${{needs.build.outputs.version}}" >> $GITHUB_ENV | ||
- name: Compress DLLs | ||
run: | | ||
cd plugins/ | ||
zip ${{env.FILE_NAME}}.zip -r * | ||
- name: Upload release asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{steps.create-draft.outputs.upload_url}} | ||
asset_path: ./plugins/${{env.FILE_NAME}}.zip | ||
asset_name: ${{env.FILE_NAME}}.zip | ||
asset_content_type: application/zip |