Add build and push release tags automation to onebranch #202
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: OneBranch-Style Build | |
on: | |
push: | |
branches: main | |
tags: # Trigger when a tag is pushed | |
- 'v*' # Match tags starting with 'v' | |
pull_request: | |
branches: main | |
permissions: read-all | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [x64, arm64] | |
name: Build | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
with: | |
submodules: 'recursive' | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce | |
- name: Pre-Build | |
shell: pwsh | |
run: ./.azure/pre-build.ps1 -Arch ${{ matrix.arch }} | |
- name: Build | |
run: msbuild ./build/ALL_BUILD.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.arch }} | |
- name: Post-Build | |
shell: pwsh | |
run: ./.azure/post-build.ps1 -Arch ${{ matrix.arch }} | |
- name: Upload | |
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b | |
with: | |
name: bin-windows-${{ matrix.arch }} | |
path: | | |
build/bin/**/*.so | |
build/bin/**/*.dll | |
build/bin/**/quicreach | |
build/bin/**/quicreach.exe | |
build/bin/**/quicreach.msi | |
release: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
name: Create Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Create Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} # Use the tag that triggered the workflow | |
release_name: Release ${{ github.ref_name }} | |
body: | | |
## Release Notes | |
Automated release for tag ${{ github.ref_name }}. | |
draft: false | |
prerelease: false | |
- name: Upload Release Assets | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: build/bin/**/*.msi | |
asset_name: quicreach-${{ github.ref_name }}-${{ matrix.arch }}.msi | |
asset_content_type: application/octet-stream |