-
Notifications
You must be signed in to change notification settings - Fork 14
146 lines (141 loc) · 5.5 KB
/
publish-dev.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
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Publish dev Build
on:
push:
branches:
- master
tags:
- "v*.*.*"
workflow_dispatch:
jobs:
publish:
strategy:
matrix:
rid: [ win-x64, linux-x64, linux-arm64, osx-x64, osx-arm64 ]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
# - name: Restore dependencies
# run: dotnet restore
- name: Set Version in csproj
# replace <Version>0.0.0</Version> with <Version>tag</Version>, where tag is the tag name, tag should trim start "v"
run: sed -i "s/<Version>.*<\/Version>/<Version>$(echo ${{github.ref_name}} | sed 's@v@@g')<\/Version>/g" ./MementoMori.WebUI/MementoMori.WebUI.csproj
if: startsWith(github.ref, 'refs/tags/')
- name: Publish ${{matrix.rid}}
run: dotnet workload restore && dotnet publish ./MementoMori.WebUI/MementoMori.WebUI.csproj -f net8.0 -c Release -r ${{matrix.rid}} -o publish-${{matrix.rid}} --sc -p:PublishSingleFile=true -p:IncludeAllContentForSelfExtract=true -p:EnableCompressionInSingleFile=true
- name: Archive Release ${{matrix.rid}}
uses: thedoctor0/[email protected]
with:
type: 'zip'
filename: 'publish-${{matrix.rid}}.zip'
path: './publish-${{matrix.rid}}/'
- name: Create Dev Release
uses: softprops/action-gh-release@v1
if: github.ref == 'refs/heads/master'
with:
files: |
./publish-${{matrix.rid}}.zip
tag_name: dev
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
./publish-${{matrix.rid}}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-docker:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
moonheartmoon/mementomori-webui
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set Version in csproj
# replace <Version>0.0.0</Version> with <Version>tag</Version>, where tag is the tag name, tag should trim start "v"
run: sed -i "s/<Version>.*<\/Version>/<Version>$(echo ${{github.ref_name}} | sed 's@v@@g')<\/Version>/g" ./MementoMori.WebUI/MementoMori.WebUI.csproj
if: startsWith(github.ref, 'refs/tags/')
- name: Build and push
uses: docker/build-push-action@v5
if: startsWith(github.ref, 'refs/tags/')
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
context: .
platforms: linux/amd64,linux/arm64
file: ./MementoMori.WebUI/Dockerfile
labels: ${{ steps.meta.outputs.labels }}
- name: Build and push
uses: docker/build-push-action@v5
if: startsWith(github.ref, 'refs/heads/master')
with:
push: true
tags: moonheartmoon/mementomori-webui:dev
context: .
platforms: linux/amd64,linux/arm64
file: ./MementoMori.WebUI/Dockerfile
publish-maui-android:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Install MAUI workload
run: dotnet workload install maui
- name: Write keystore
run: |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.KEYSTORE_BASE64_ENCODED }}")
[IO.File]::WriteAllBytes("MementoMori.Maui/mementomori-helper.keystore", $pfx_cert_byte)
- name: Build Android
run: dotnet publish .\MementoMori.Maui\MementoMori.Maui.csproj -c Release -f net8.0-android -p:AndroidSigningStorePass=env:KEYSTORE_PASSWORD -p:AndroidSigningKeyPass=env:KEYSTORE_PASSWORD -p:ApplicationDisplayVersion=$((echo ${{github.ref_name}}) -replace 'v') -p:ApplicationVersion=${{github.run_number}} -o publish-android
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
- name: Create Dev Release
uses: softprops/action-gh-release@v1
if: github.ref == 'refs/heads/master'
with:
files: |
./publish-android/io.github.moonheart.mementomorihelper-Signed.apk
tag_name: dev
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
./publish-android/io.github.moonheart.mementomorihelper-Signed.apk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}