Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Commit 0df996e

Browse files
authored
Create build-and-publish.yml
1 parent 019f804 commit 0df996e

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Build and publish
2+
3+
on:
4+
push:
5+
pull_request:
6+
release:
7+
types: [created]
8+
9+
env:
10+
APP_NAME: UnityDevelopmentBuildMaker
11+
OUTPUT_DIR: ./output
12+
OUTPUT_ZIP: ../output.zip
13+
14+
jobs:
15+
build:
16+
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
configuration: [Release]
21+
runtime: ['win-x64', 'win-x86']
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
- name: Setup dotnet
27+
uses: actions/setup-dotnet@v1
28+
with:
29+
dotnet-version: '6.0.x'
30+
31+
- name: dotnet restore
32+
run: dotnet restore
33+
34+
- name: dotnet publish
35+
run: dotnet publish --no-restore -c ${{ matrix.configuration }} -r ${{ matrix.runtime }} -o ${{ env.OUTPUT_DIR }} --self-contained
36+
37+
- name: Upload build artifacts
38+
uses: actions/upload-artifact@v2
39+
with:
40+
name: ${{ env.APP_NAME }}-${{ matrix.runtime }}-${{ matrix.configuration }}
41+
path: ${{ env.OUTPUT_DIR }}
42+
43+
- name: Zip
44+
if: github.event_name == 'release' && ${{ matrix.configuration }} == 'Release'
45+
run: zip -qq -r ${{ env.OUTPUT_ZIP }} *
46+
working-directory: ${{ env.OUTPUT_DIR }}
47+
48+
- name: Get release
49+
if: github.event_name == 'release' && ${{ matrix.configuration }} == 'Release'
50+
id: get-release
51+
uses: bruceadams/get-release@v1.2.3
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
55+
- name: Upload release
56+
if: github.event_name == 'release' && ${{ matrix.configuration }} == 'Release'
57+
uses: actions/upload-release-asset@v1.0.2
58+
env:
59+
GITHUB_TOKEN: ${{ github.token }}
60+
with:
61+
upload_url: ${{ steps.get-release.outputs.upload_url }}
62+
asset_path: ${{ env.OUTPUT_DIR }}/${{ env.OUTPUT_ZIP }}
63+
asset_name: ${{ env.APP_NAME }}-${{ matrix.runtime }}
64+
asset_content_type: application/zip

0 commit comments

Comments
 (0)