This repository has been archived by the owner on Dec 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add build and release workflow (#1)
Significant changes: - Set up MSVC for building - Build `.lib` file using MSBuild - Upload built artifacts to release - Download `.lib` file in the release job - Generate SHA256 hashes for downloaded files - Upload hashes to release as an artifact - Create a GitHub release with uploaded files and hashes - Comment on the created release with the generated hashes Additionally, there are some changes made to project files: 1. Added an additional include directory in `Example.vcxproj` 2. Changed configuration type to static library in `RegistryHelper.vcxproj` 3. Modified precompiled header settings in `UnitTest.vcxproj`
- Loading branch information
Showing
4 changed files
with
84 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Build and Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- workflowTest | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up MSVC | ||
uses: microsoft/[email protected] | ||
|
||
- name: Build .lib file | ||
run: | | ||
msbuild /p:Configuration=Release /t:RegistryHelper /p:Platform=x64 RegistryHelper.sln | ||
- name: Upload to Release | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: lib-artifact | ||
path: | | ||
x64/Release/RegistryHelper.lib | ||
x64/Release/RegistryHelper.pdb | ||
|
||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Download .lib file | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: lib-artifact | ||
|
||
- name: Generate SHA256 hashes | ||
id: hashes | ||
run: | | ||
for file in lib-artifact/*; do | ||
echo "$(basename "$file"): $(sha256sum "$file" | cut -d' ' -f1)" >> hash.txt | ||
done | ||
echo "::set-output name=hashes::$(cat hash.txt)" | ||
- name: Upload hashes to Release | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: hash-artifact | ||
path: hash.txt | ||
|
||
- name: Display hashes | ||
run: | | ||
cat hash.txt | ||
- name: Create Release | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
lib-artifact/* | ||
hash-artifact/* | ||
data: | | ||
{ "hashes": "${{ steps.hashes.outputs.hashes }}" } | ||
- name: Comment on Release | ||
run: | | ||
echo "Release with hashes: ${{ steps.create_release.outputs.hashes }}" > release_message.txt | ||
cat release_message.txt | ||
env: | ||
RELEASE_HASHES: ${{ steps.create_release.outputs.hashes }} | ||
|
||
- name: Comment on Release | ||
run: | | ||
gh release upload ${{ github.repository }} ${{ steps.create_release.outputs.id }} release_message.txt --title "Release Notes" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters