Skip to content

Commit

Permalink
Only create release off tag if commit is on main
Browse files Browse the repository at this point in the history
  • Loading branch information
Marty Spiewak committed Mar 18, 2022
1 parent 00193fd commit fa8800d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,25 @@ name: release
on:
push:
tags:
- 'v*'
- 'v[0-9]+\.[0-9]+\.[0-9]+(-build\.[0-9]+)?'

jobs:
check-if-main:
runs-on: ubuntu-latest
outputs:
on_main: ${{ steps.check.outputs.on_main }}
steps:
- name: check if commit is on main
id: check
run: |
if [[ $(git branch --contains $(git rev-parse HEAD) | grep -E '(^|\s)main$') ]]; then
echo "::set-output name=on_main::true"
fi
release:
runs-on: ubuntu-latest
needs: check-if-main
if: needs.check-if-main.ouputs.on_main == 'true'
permissions:
contents: write
env:
Expand Down

0 comments on commit fa8800d

Please sign in to comment.