Compile, Tag, and Release Binary #20
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
name: Compile, Tag, and Release Binary | |
on: | |
workflow_dispatch: | |
jobs: | |
build-tag-release: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up MSVC | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Compile C++ code | |
run: | | |
cd src | |
cl /EHsc /W4 /Fe:lsass_ASR_test.exe lsass_test.cpp | |
Move lsass_ASR_test.exe ../ | |
- name: Create and Push Tag | |
run: | | |
git config user.name "github-actions" | |
git config user.email "github-actions@github.com" | |
$TAG_NAME="release-$(Get-Date -Format 'yyyyMMddHHmmss')" | |
git tag $TAG_NAME | |
git push origin $TAG_NAME | |
echo "TAG_NAME=$TAG_NAME" | Out-File -Append -FilePath $env:GITHUB_ENV | |
shell: pwsh | |
- name: Create Release and Upload Binary | |
uses: softprops/action-gh-release@v1 | |
env: | |
TAG_NAME: ${{ env.TAG_NAME }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: lsass_ASR_test.exe | |
tag_name: ${{ env.TAG_NAME }} | |
- name: Update Download Link in File | |
env: | |
TAG_NAME: ${{ env.TAG_NAME }} | |
run: | | |
$releaseUrl = "https://github.com/MHaggis/ASRGEN/releases/download/${{ env.TAG_NAME }}/lsass_ASR_test.exe" | |
Write-Output "Release URL: $releaseUrl" | |
$filePath = "pages\2_ASR Atomic Testing.py" | |
Write-Output "File Path: $filePath" | |
$fileContent = Get-Content $filePath | |
Write-Output "File Content: $fileContent" | |
$updatedContent = $fileContent -replace 'The generated binary may be found here:.*', ("The generated binary may be found here: " + $releaseUrl + ',",') | |
Write-Output "Updated Content: $updatedContent" | |
Set-Content -Path $filePath -Value $updatedContent | |
Write-Output "File content updated successfully." | |
shell: pwsh | |
- name: Commit and Push Changes | |
run: | | |
git config --local user.email "github-actions@github.com" | |
git config --local user.name "GitHub Actions" | |
git add $filePath | |
git add "pages\2_ASR Atomic Testing.py" | |
git commit -m "Update download link for lsass_ASR_test.exe" | |
git push | |