-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (79 loc) · 2.54 KB
/
editor_build.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
name: Editor Build and Release
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build-editor:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Checkout Vortex Engine
uses: actions/checkout@v3
with:
repository: 'StoneOrbits/VortexEngine'
path: 'VortexEditor/VortexEngine'
ref: 'desktop'
- name: Set up MSBuild path
uses: microsoft/setup-msbuild@v1
- name: Build
run: msbuild VortexEditor.sln /p:Configuration=Release /p:Platform=x64
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: Binaries
path: x64/Release/VortexEditor.exe
create-release:
runs-on: windows-latest
needs: build-editor
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Important: fetch all history so we can get all tags
- name: Calculate new version
id: versioning
shell: bash
run: |
# Fetch tags
git fetch --tags
# Get latest tag, assuming the tag is in the format v[MAJOR].[MINOR], e.g., v1.0
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Latest tag: $latest_tag"
# Increment the minor version. If no tag found, start at v1.0
if [[ $latest_tag =~ ^(v[0-9]+)\.([0-9]+)$ ]]; then
major=${BASH_REMATCH[1]}
minor=${BASH_REMATCH[2]}
new_tag="$major.$((minor+1))"
else
new_tag="v1.0"
fi
echo "New tag: $new_tag"
echo "NEW_TAG=$new_tag" >> $GITHUB_ENV
- name: Create and push new tag
shell: bash
run: |
git config user.name github-actions
git config user.email [email protected]
git tag ${{ env.NEW_TAG }}
git push origin ${{ env.NEW_TAG }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.NEW_TAG }}
release_name: Release ${{ env.NEW_TAG }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./x64/Release/VortexEditor.exe
asset_name: VortexEditor.exe
asset_content_type: application/octet-stream