Skip to content

Commit 35d6161

Browse files
committed
refactor / clean CI workflow code
1 parent 140a37f commit 35d6161

File tree

1 file changed

+22
-49
lines changed

1 file changed

+22
-49
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jobs:
2222
build:
2323
name: Visual Studio 2019
2424
runs-on: windows-2019
25+
env:
26+
ARTIFACT_NAME: logreader-${{ matrix.config.config }}-${{ matrix.config.platform }}.7z
27+
2528
strategy:
2629
fail-fast: false
2730
matrix:
@@ -56,35 +59,36 @@ jobs:
5659
5760
- name: Run Unit Tests - ${{ matrix.config.config }} - ${{ matrix.config.platform }}
5861
shell: sh
59-
run: |
60-
./${{ matrix.config.output_dir }}/tests.exe
62+
run: ./${{ matrix.config.output_dir }}/tests.exe
6163

6264
- name: Copy Executable
6365
shell: sh
6466
run: |
6567
mkdir -p -- "$RUNNER_TEMP/instdir"
6668
cp -- ./${{ matrix.config.output_dir }}/LogReader.exe "$RUNNER_TEMP/instdir"
6769
68-
- name: Pack
69-
env:
70-
ARCHIVE_FILE: ${{ runner.temp }}/logreader-${{ matrix.config.config }}-${{ matrix.config.platform }}.7z
70+
- name: Pack Build Artifact
7171
working-directory: ${{ runner.temp }}/instdir
7272
shell: sh
73-
run: cmake -E tar vcf "$ARCHIVE_FILE" --format=7zip -- .
73+
run: cmake -E tar vcf "$RUNNER_TEMP/$ARTIFACT_NAME" --format=7zip -- .
7474

75-
- name: Upload
75+
- name: Upload Build Artifact
7676
uses: actions/upload-artifact@v2
7777
with:
78-
path: ${{ runner.temp }}/logreader-${{ matrix.config.config }}-${{ matrix.config.platform }}.7z
79-
name: logreader-${{ matrix.config.config }}-${{ matrix.config.platform }}.7z
78+
path: ${{ runner.temp }}/${{ env.ARTIFACT_NAME }}
79+
name: ${{ env.ARTIFACT_NAME }}
8080

81-
release:
81+
create-release:
8282
name: Create Release for ${{ github.ref }}
8383
if: contains(github.ref, 'tags/v')
8484
runs-on: ubuntu-latest
85-
needs: build
85+
needs:
86+
- build
87+
- check-formatting
8688
permissions:
8789
contents: write
90+
env:
91+
ARTIFACT_NAME: logreader-Release-x64.7z
8892

8993
steps:
9094
- name: Create Release
@@ -94,54 +98,23 @@ jobs:
9498
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9599
with:
96100
tag_name: ${{ github.ref }}
97-
release_name: Release ${{ github.ref }}
101+
release_name: ${{ github.ref }}
98102
draft: false
99103
prerelease: false
100104

101-
- name: Store Release url
102-
shell: sh
103-
run: |
104-
echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url
105-
106-
- uses: actions/upload-artifact@v2
107-
with:
108-
path: ./upload_url
109-
name: upload_url
110-
111-
publish:
112-
if: contains(github.ref, 'tags/v')
113-
name: Publish Release Artifacts from Visual Studio 2019
114-
runs-on: ubuntu-latest
115-
needs: release
116-
permissions:
117-
contents: write
118-
119-
steps:
120-
- name: Download artifact
121-
uses: actions/download-artifact@v2
122-
with:
123-
name: logreader-Release-x64.7z
124-
path: ./
125-
126-
- name: Download URL
105+
- name: Download Artifact
127106
uses: actions/download-artifact@v2
128107
with:
129-
name: upload_url
108+
name: ${{ env.ARTIFACT_NAME }}
130109
path: ./
131110

132-
- id: set_upload_url
133-
shell: sh
134-
run: |
135-
upload_url=`cat ./upload_url`
136-
echo ::set-output name=upload_url::$upload_url
137-
138-
- name: Upload to Release
111+
- name: Upload Artifact to Release
139112
id: upload_to_release
140113
uses: actions/upload-release-asset@v1
141114
env:
142115
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
143116
with:
144-
upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
145-
asset_path: ./logreader-Release-x64.7z
146-
asset_name: logreader-Release-x64.7z
117+
upload_url: ${{ steps.create_release.outputs.upload_url }}
118+
asset_path: ./${{ env.ARTIFACT_NAME }}
119+
asset_name: ${{ env.ARTIFACT_NAME }}
147120
asset_content_type: application/x-7z-compressed

0 commit comments

Comments
 (0)