Skip to content

Commit

Permalink
chore: add on push with tag structure
Browse files Browse the repository at this point in the history
  • Loading branch information
maancham committed Jul 25, 2024
1 parent 0186c5b commit 6e78491
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions .github/workflows/build-contracts-and-push-to-r2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches:
- main
- fix/push-releases-to-r2
tags:
- '*-v[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
inputs:
branch:
Expand All @@ -27,12 +29,36 @@ jobs:
id: get-tag
run: |
echo "github_ref=$GITHUB_REF"
# if [[ $GITHUB_REF == refs/tags/* ]]; then
# echo "tag:${GITHUB_REF#refs/tags/}"
# echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
# else
# echo "tag=" >> $GITHUB_OUTPUT
# fi
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "tag=${GITHUB_REF#refs/tags/}"
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
else
echo "tag=" >> $GITHUB_OUTPUT
fi
- name: Check for release information from tag
id: check-release
run: |
tag="${{ steps.get-tag.outputs.tag }}"
is_release="false"
if [[ $tag =~ ^([a-zA-Z-]+)-v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
is_release="true"
crate_name="${BASH_REMATCH[1]}"
crate_version="${BASH_REMATCH[2]}"
echo "Is release: $is_release"
echo "Crate Name: $crate_name"
echo "Crate Version: $crate_version"
echo "is-release=$is_release" >> $GITHUB_OUTPUT
echo "crate-name=$crate_name" >> $GITHUB_OUTPUT
echo "crate-version=$crate_version" >> $GITHUB_OUTPUT
else
echo "Is release: $is_release"
echo "Not a release tag. Skipping crate name and version extraction."
echo "is-release=$is_release" >> $GITHUB_OUTPUT
fi
# - name: Check for release information if present
# id: check-release
Expand Down

0 comments on commit 6e78491

Please sign in to comment.