-
Notifications
You must be signed in to change notification settings - Fork 16
72 lines (61 loc) · 2.34 KB
/
create-release.yml
File metadata and controls
72 lines (61 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
################################################################################
### Build AsepriteDotNet (Release)
### Builds, tests, and packs the AsepriteDotNet source libraries.
### Once the build job finishes, the deploy job uploads the nupkg files to NuGet.
###
### - Can be triggered manually with workflow_dispatch
### - Allows specifying a branch (defaults to develop)
### - Version numbers are determined by the project properties on the branch
################################################################################
name: "Create Release"
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to build from (e.g., main, develop)'
required: true
type: string
default: 'develop'
jobs:
build:
name: "Build AsepriteDotNet"
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Setup Dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build AsepriteDotNet
run: dotnet build source/AsepriteDotNet/AsepriteDotNet.csproj --nologo --verbosity minimal --configuration Release
- name: Test AsepriteDotNet
run: dotnet test tests/AsepriteDotNet.Tests/AsepriteDotNet.Tests.csproj --nologo --verbosity minimal --configuration Release
- name: Pack AsepriteDotNet
run: dotnet pack source/AsepriteDotNet/AsepriteDotNet.csproj --nologo --verbosity minimal --configuration Release
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: ./.artifacts/src/**/*.nupkg
deploy:
name: "Deploy NuGets"
runs-on: ubuntu-latest
needs: [ build ]
permissions:
contents: write
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: ./.artifacts
- name: Push Packages to NuGet
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
for PACKAGE in .artifacts/**/*.nupkg; do
dotnet nuget push "$PACKAGE" --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key "$NUGET_API_KEY"
done