-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (84 loc) · 2.59 KB
/
release.yaml
File metadata and controls
103 lines (84 loc) · 2.59 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Release
on:
workflow_dispatch:
push:
branches:
- 'main'
paths:
- '.github/workflows/release.yaml'
- '.github/workflows/build-project.yaml'
- '.nuke/**'
- 'build/**'
- 'dist/**'
- 'src/**'
- 'Aegir.sln'
- 'run.*'
- 'global.json'
env:
ContinuousIntegrationBuild: true
Game: valheim
Name: Aegir
jobs:
check-tag:
runs-on: windows-latest
name: Check release tag existence
outputs:
tag: ${{ steps.check.outputs.tag }}
version: ${{ steps.check.outputs.version }}
steps:
- uses: actions/checkout@v6
- name: Checking tag
id: check
env:
GH_TOKEN: ${{ github.token }}
run: |
$XML = [Xml] (Get-Content ${{ github.workspace }}\src\${{ env.Name }}.csproj);
$CurrentVersion = [Version] $XML.Project.PropertyGroup.Version;
echo "Current version: $CurrentVersion";
echo "Current tag: v$CurrentVersion";
echo "tag=v$CurrentVersion" >> $env:GITHUB_OUTPUT;
echo "version=$CurrentVersion" >> $env:GITHUB_OUTPUT;
$Response = gh api `
-H "Accept: application/vnd.github+json" `
-H "X-GitHub-Api-Version: 2022-11-28" `
/repos/blbrdv/${{ env.Name }}/tags `
| ConvertFrom-Json;
foreach ($Tag in $Response) {
if ($Tag.name -eq "v$CurrentVersion") {
echo "Tag 'v$CurrentVersion' already exists. Update project version.";
exit 1;
}
}
build:
needs: check-tag
name: Build project
uses: ./.github/workflows/build-project.yaml
with:
target-ref: 'main'
github-release:
needs: [ build, check-tag ]
name: Github release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Download project artefact
uses: actions/download-artifact@v5
with:
name: plugin-${{ github.sha }}
- name: Parse changelog
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
validation_level: warn
version: ${{ needs.check-tag.outputs.version }}
path: ${{ github.workspace }}/CHANGELOG.md
- name: GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.check-tag.outputs.tag }}
body: ${{ steps.changelog_reader.outputs.changes }}
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: false
artifacts: ${{ github.workspace }}/${{ env.Name }}.dll