Skip to content

Commit

Permalink
Fix workflow to include version on the file name of the build artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
umireon committed Dec 31, 2023
1 parent e6c4cfb commit e67b4eb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
38 changes: 30 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,61 @@ jobs:
- "Release"

steps:
- name: "Get version"
shell: bash
run: |
if [[ $GITHUB_REF =~ ^refs/tags/ ]]
then version="${GITHUB_REF#refs/tags/}"
else version=main
fi
printf "version=%s" "$version" > "$GITHUB_OUTPUT"
id: "get-version"

- uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Run Build-Windows.ps1"
run: "./Build-Windows.ps1 -Configuration ${{ matrix.config }}"
run: "./Build-Windows.ps1 -Configuration ${{ matrix.config }} -Version ${{ steps.get-version.outputs.version }}"

- uses: "actions/upload-artifact@v3"
with:
name: "onnxruntime-win-${{ matrix.config }}"
path: "release/onnxruntime-windows-${{ matrix.config }}.zip"
path: "release/*.zip"

Release:
runs-on: "ubuntu-22.04"

if: "github.event_name == 'push' && contains(github.ref, 'refs/tags/')"

needs:
- "BuildWindows"

permissions:
contents: "write"

defaults:
run:
shell: "bash"

steps:
- name: "Get Metadata"
id: "metadata"
- name: "Get version"
run: |
echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
if [[ $GITHUB_REF =~ ^refs/tags/ ]]
then version="${GITHUB_REF#refs/tags/}"
else version=main
fi
printf "version=%s" "$version" > "$GITHUB_OUTPUT"
id: "get-version"

- name: "Download build artifacts"
uses: "actions/download-artifact@v3"

- name: "Create Release"
uses: "softprops/action-gh-release@v1"
uses: "softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5"
with:
draft: true
tag_name: "${{ steps.metadata.outputs.version }}"
name: "${{ steps.metadata.outputs.version }}"
tag_name: "${{ steps.get-version.outputs.version }}"
name: "${{ steps.get-version.outputs.version }}"
files: |
${{ github.workspace }}/**/*.zip
4 changes: 2 additions & 2 deletions Build-Windows.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Param($Configuration)
Param($Configuration, $Version)

if (Test-Path release) {
Remove-Item release -Recurse -Force
Expand Down Expand Up @@ -63,4 +63,4 @@ foreach ($lib in $libArray) {
Copy-Item $lib release\$Configuration\lib -Verbose
}

Compress-Archive release\$Configuration\* release\onnxruntime-windows-$Configuration.zip -Verbose
Compress-Archive release\$Configuration\* release\onnxruntime-windows-$Version-$Configuration.zip -Verbose

0 comments on commit e67b4eb

Please sign in to comment.