Skip to content

Commit 53d0c6b

Browse files
committed
add GitHub actions CI config
1 parent 96b9772 commit 53d0c6b

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed

.github/workflows/main.yml

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
name: Build MSVC project
3+
4+
on: [ push, pull_request ]
5+
6+
jobs:
7+
build:
8+
name: Visual Studio 2019
9+
runs-on: windows-2019
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Add msbuild to PATH
15+
uses: microsoft/[email protected]
16+
with:
17+
msbuild-architecture: x64
18+
19+
- name: Build MSVC project
20+
shell: sh
21+
run: |
22+
MSBuild.exe ./LogReader.sln /property:Configuration=Release
23+
24+
- name: Copy Executable
25+
shell: sh
26+
run: |
27+
mkdir -p -- "$RUNNER_TEMP/instdir"
28+
cp -- ./Release-x64/LogReader.exe "$RUNNER_TEMP/instdir"
29+
30+
- name: Pack
31+
working-directory: ${{ runner.temp }}/instdir
32+
shell: sh
33+
run: cmake -E tar cfv "$RUNNER_TEMP/msvc.7z" --format=7zip -- .
34+
35+
- name: Upload
36+
uses: actions/upload-artifact@v2
37+
with:
38+
path: ${{ runner.temp }}/msvc.7z
39+
name: logreader-msvc.7z
40+
41+
release:
42+
name: Create Release for ${{ github.ref }}
43+
if: contains(github.ref, 'tags/v')
44+
runs-on: ubuntu-latest
45+
needs: build
46+
permissions:
47+
contents: write
48+
49+
steps:
50+
- name: Create Release
51+
id: create_release
52+
uses: actions/create-release@v1
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
with:
56+
tag_name: ${{ github.ref }}
57+
release_name: Release ${{ github.ref }}
58+
draft: false
59+
prerelease: false
60+
61+
- name: Store Release url
62+
shell: sh
63+
run: |
64+
echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url
65+
66+
- uses: actions/upload-artifact@v2
67+
with:
68+
path: ./upload_url
69+
name: upload_url
70+
71+
publish:
72+
if: contains(github.ref, 'tags/v')
73+
name: Publish Release Artifacts from Visual Studio 2019
74+
runs-on: ubuntu-latest
75+
needs: release
76+
permissions:
77+
contents: write
78+
79+
steps:
80+
- name: Download artifact
81+
uses: actions/download-artifact@v2
82+
with:
83+
name: logreader-msvc.7z
84+
path: ./
85+
86+
- name: Download URL
87+
uses: actions/download-artifact@v2
88+
with:
89+
name: upload_url
90+
path: ./
91+
92+
- id: set_upload_url
93+
shell: sh
94+
run: |
95+
upload_url=`cat ./upload_url`
96+
echo ::set-output name=upload_url::$upload_url
97+
98+
- name: Upload to Release
99+
id: upload_to_release
100+
uses: actions/upload-release-asset@v1
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
with:
104+
upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
105+
asset_path: ./logreader-msvc.7z
106+
asset_name: logreader-msvc.7z
107+
asset_content_type: application/x-7z-compressed

0 commit comments

Comments
 (0)