Skip to content

Commit

Permalink
Fix release naming
Browse files Browse the repository at this point in the history
  • Loading branch information
rickyelopez committed May 15, 2024
1 parent 5859943 commit a572acb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/actions/archive/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ runs:
[[ -z $sha_short ]] && sha_short="unknown"
echo "sha_short=$sha_short" >> "$GITHUB_OUTPUT"
echo "github_ref: ${{ github.ref }}"
if [[ ${{ github.ref }} =~ refs/tags/v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
export archive_name="conUDS_${{ github.ref_name }}_${{ inputs.target }}.zip"
if [[ "$GIT_TAG" != "none" ]]; then
printf "\nThis commit has a tag, using that in the archive name\n"
export archive_name="conUDS_${GIT_TAG}_${{ inputs.target }}.zip"
else
export archive_name="conUDS_${sha_short}_${{ inputs.target }}.zip"
fi
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ on:
push:
branches:
- main

name: Auto Release
jobs:
build_and_release:
name: Build
name: Build and Release
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -18,13 +19,19 @@ jobs:
- uses: ./.github/actions/build-rust
with:
target: ${{ matrix.target }}
- name: Get Tag
shell: bash
run: |
export GIT_TAG=$(git describe --tags --abbrev=0)
[[ -z "$GIT_TAG" ]] && GIT_TAG=none
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV
- name: Create Artifact Archive
id: create-archive
uses: ./.github/actions/archive
with:
target: ${{ matrix.target }}
# make pre-release for regular pushes
- if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
- if: ${{ env.GIT_TAG == 'none' }}
uses: marvinpinto/[email protected]
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
Expand All @@ -35,7 +42,7 @@ jobs:
${{ steps.create-archive.outputs.archive_name }}
CHECKSUM
# make a real release if there's a tag
- if: ${{ startsWith(github.ref, 'refs/tags/v') }}
- if: ${{ env.GIT_TAG != 'none' }}
uses: marvinpinto/[email protected]
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
Expand Down

0 comments on commit a572acb

Please sign in to comment.