add_build_to_release #12
Workflow file for this run
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
name: add_build_to_release | |
on: | |
release: | |
types: [ "created" ] | |
env: | |
BUILD_PROJECT: "SpaceShooter2" | |
PUBLISH_ARCHITECTURES: "linux-x64 win-x64" | |
PRODUCED_FILES: "" | |
jobs: | |
add_build_to_release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 6.0.x | |
- name: restore dependencies | |
run: dotnet restore ${{env.BUILD_PROJECT}} | |
- name: publish and compress architectures | |
run: | | |
produced_files="" | |
[ ! -d "${{github.workspace}}/builds" ] && mkdir "${{github.workspace}}/builds" | |
for arch in ${{env.PUBLISH_ARCHITECTURES}}; do | |
echo "processing architecture '$arch'" | |
dotnet publish ${{env.BUILD_PROJECT}} -c Release --self-contained -r "$arch" | |
fname="${{github.workspace}}/builds/${arch}_${{env.BUILD_PROJECT}}.zip" | |
cd "${{env.BUILD_PROJECT}}/bin/Release/net6.0/$arch" | |
zip $fname * | |
cd - | |
echo "created $fname" | |
done | |
- name: upload release assets | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{github.event.release.tag_name}} | |
files: "${{github.workspace}}/builds/*" | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |