-
-
Notifications
You must be signed in to change notification settings - Fork 20
92 lines (90 loc) · 3.71 KB
/
build_dev_version.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
name: Build development version
on:
push:
branches:
- '**' # This will trigger the workflow on push to any branch
jobs:
upload_dev_build_artifact:
name: Upload development build
runs-on: ${{ matrix.os }}
environment: "Build Environment"
strategy:
matrix:
build:
- win-x64
- linux-x64
include:
- build: win-x64
os: windows-latest
archive_type: zip
archive_extension: .zip
- build: linux-x64
os: ubuntu-latest
archive_type: tar
archive_extension: .tgz
steps:
- name: Get branch name (Windows)
if: runner.os == 'Windows'
run: echo "BRANCH_NAME=${{ github.ref }}" | ForEach-Object {$_ -replace 'refs/heads/', ''} | Out-File -Append $env:GITHUB_ENV
env:
GITHUB_REF: ${{ github.ref }}
- name: Get branch name (Unix)
if: runner.os != 'Windows'
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
env:
GITHUB_REF: ${{ github.ref }}
- name: "Modify the branch name to be used in artifact name (Windows)"
if: runner.os == 'Windows'
run: echo "BRANCH_NAME=${BRANCH_NAME.Replace('/', '-').Replace('\', '-').Replace(':', '-').Replace('<', '-').Replace('>', '-').Replace('|', '-').Replace('*', '-').Replace('?', '-').Replace('\r', '-').Replace('\n', '-').Replace('/', '-').Replace('\\', '-')}" | Out-File -Append $env:GITHUB_ENV
- name: "Modify the branch name to be used in artifact name (Unix)"
if: runner.os != 'Windows'
# Invalid characters include: Double quote ", Colon :, Less than <, Greater than >, Vertical bar |, Asterisk *, Question mark ?, Carriage return \r, Line feed \n, Backslash \, Forward slash /
run: echo "BRANCH_NAME=${BRANCH_NAME//[^a-zA-Z0-9]/-}" >> $GITHUB_ENV
- name: Remove old artifacts
uses: ThreadsStyling/purge-artifacts-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
expire-in: 0
onlyPrefix: 'ImperatorToCK3-${{ matrix.build }}-dev-${{ env.BRANCH_NAME }}'
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: "Setup Dotnet for use with actions"
uses: actions/setup-dotnet@v4
with:
global-json-file: Fronter.NET/global.json
- name: "Replace frontend background image"
run: |
rm Fronter.NET/Fronter.NET/Assets/Images/background.png
cp ImperatorToCK3/Resources/images/SteamMainImage.png Fronter.NET/Fronter.NET/Assets/Images/background.png
- name: "Build frontend"
uses: ./Fronter.NET/.github/actions/build_frontend
with:
fronter_dir: 'Fronter.NET'
release_dir: 'Publish'
env:
BACKBLAZE_KEY_ID: ${{ secrets.BACKBLAZE_KEY_ID }}
BACKBLAZE_APPLICATION_KEY: ${{ secrets.BACKBLAZE_APPLICATION_KEY }}
BACKBLAZE_BUCKET_ID: ${{ secrets.BACKBLAZE_BUCKET_ID }}
- name: Setup Dotnet for use with actions
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: "Build backend"
working-directory: ImperatorToCK3
run: |
dotnet publish -p:PublishProfile=${{ matrix.build }} -c:Release --output:"../Publish/ImperatorToCK3"
- name: Archive Publish folder
uses: thedoctor0/zip-release@master
with:
type: ${{ matrix.archive_type }}
directory: 'Publish'
path: '.'
filename: '../ImperatorToCK3-${{ matrix.build }}-dev${{ matrix.archive_extension }}'
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: 'ImperatorToCK3-${{ matrix.build }}-dev-${{ env.BRANCH_NAME }}'
path: 'ImperatorToCK3-${{ matrix.build }}-dev${{ matrix.archive_extension }}'
retention-days: 20