-
Notifications
You must be signed in to change notification settings - Fork 31
133 lines (113 loc) · 4.86 KB
/
dotnet-release.yml
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: release
on:
push:
branches: ["release"]
jobs:
build:
runs-on: windows-latest
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol crlf
- uses: actions/checkout@v1
name: Checkout Code
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: "9.0.x"
- name: Restore NuGet Packages
run: dotnet restore src/BriefingRoom.sln
- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYMMDD-HHMMSS
utcOffset: "+00:00"
- name: Get current date
uses: 1466587594/get-current-time@v2
id: current-date
with:
format: YMM.DD
utcOffset: "+00:00"
- name: Set Build Version
id: build_version
run: |
(Get-Content -path src\BriefingRoom\BriefingRoom.cs -Raw) -replace '~BUILD_VERSION~','${{ steps.current-time.outputs.formattedTime }}' | Set-Content src\BriefingRoom\BriefingRoom.cs
- name: Set Release Version
id: release_version
run: |
(Get-Content -path src\BriefingRoom\BriefingRoom.cs -Raw) -replace '~RELEASE_VERSION~','${{ steps.current-date.outputs.formattedTime }}' | Set-Content src\BriefingRoom\BriefingRoom.cs
- name: Build and Publish App
run: |
dotnet publish src/CommandLine -o BriefingRoom-V0.5.${{ steps.current-date.outputs.formattedTime }} -c Release
dotnet publish src/Web -o BriefingRoom-V0.5.${{ steps.current-date.outputs.formattedTime }} -c Release
dotnet publish src/Desktop -o BriefingRoom-V0.5.${{ steps.current-date.outputs.formattedTime }} -c Release
- name: Zip Release
run: 7z a -tzip BriefingRoom-V0.5.${{ steps.current-date.outputs.formattedTime }}.zip BriefingRoom-V0.5.${{ steps.current-date.outputs.formattedTime }} "-xr!.git\" "-xr!.github\" "-xr!.git*" "-xr!.vscode\" "-xr!dataExtractors\" "-xr!src\" "-xr!docs\" "-x!*.bat" "-x!*.filelist"
- name: Create Changelog
id: change_log
shell: bash
run: |
LOGS=$(git log --pretty=format:"%s" HEAD...$(git describe --tags --match="release*" --abbrev=0 HEAD))
LOGS="${LOGS//'%'/'%25'}"
LOGS="${LOGS//$'\n'/'%0A'}"
LOGS="${LOGS//$'\r'/'%0D'}"
echo "::set-output name=log::$LOGS"
- name: Upload Release
uses: ncipollo/release-action@v1
with:
tag: "release-${{ steps.current-date.outputs.formattedTime }}-${{ steps.current-time.outputs.formattedTime }}-${{ github.run_id }}-${{ github.run_attempt }}"
name: "Version 0.5.${{ steps.current-date.outputs.formattedTime }}"
body: |
${{ steps.change_log.outputs.log }}
prerelease: false
artifacts: "BriefingRoom-V0.5.${{ steps.current-date.outputs.formattedTime }}.zip"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Post to Discord
uses: tsickert/[email protected]
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
content: |
@everyone New Release out https://github.com/DCS-BR-Tools/briefing-room-for-dcs/releases/tag/release-${{ steps.current-date.outputs.formattedTime }}-${{ steps.current-time.outputs.formattedTime }}-${{ github.run_id }}-${{ github.run_attempt }}
${{ steps.change_log.outputs.log }}
docker:
name: docker build and push
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYMMDD-HHMMSS
utcOffset: "+00:00"
- name: Get current date
uses: 1466587594/get-current-time@v2
id: current-date
with:
format: YMM.DD
utcOffset: "+00:00"
- name: Set Build Version
id: build_version
run: |
sed -i 's/~BUILD_VERSION~/${{ steps.current-time.outputs.formattedTime }}/g' ./src/BriefingRoom/BriefingRoom.cs
- name: Set Release Version
id: release_version
run: |
sed -i 's/~RELEASE_VERSION~/${{ steps.current-date.outputs.formattedTime }}/g' ./src/BriefingRoom/BriefingRoom.cs
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: johnharvey/dcs-briefing-room-web:0.5.${{ steps.current-date.outputs.formattedTime }}