Skip to content

Commit 474de1b

Browse files
authored
Merge pull request #10 from DMiradakis/main
Added verify job to enforce branches in cicd
2 parents 554e1a4 + b575a54 commit 474de1b

1 file changed

Lines changed: 19 additions & 13 deletions

File tree

.github/workflows/publish-to-prod.yaml

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,26 @@ env:
99
APP_NAME: Resolver
1010

1111
jobs:
12+
verify:
13+
name: Verify tag is on production
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout git repo
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Verify tag is on production branch
22+
run: |
23+
BRANCHES=$(git branch -r --contains ${{ github.ref }})
24+
if ! echo "$BRANCHES" | grep -q "origin/production"; then
25+
echo "Error: Tag must be on production branch"
26+
echo "Tag is on: $BRANCHES"
27+
exit 1
28+
fi
29+
1230
build:
13-
# Ensure the tag is on the production branch
14-
if: contains(github.event.base_ref, 'production')
31+
needs: verify # Only run if verify passes
1532
name: Build ${{ matrix.os }}-${{ matrix.arch }}
1633
runs-on: ${{ matrix.runner }}
1734
strategy:
@@ -45,17 +62,6 @@ jobs:
4562
steps:
4663
- name: Checkout git repo
4764
uses: actions/checkout@v4
48-
with:
49-
fetch-depth: 0 # Need full history to check branch
50-
51-
- name: Verify tag is on correct branch
52-
run: |
53-
BRANCHES=$(git branch -r --contains ${{ github.ref }})
54-
if ! echo "$BRANCHES" | grep -q "origin/production"; then
55-
echo "Error: Tag must be on production branch"
56-
echo "Tag is on: $BRANCHES"
57-
exit 1
58-
fi
5965

6066
- name: Setup .NET
6167
uses: actions/setup-dotnet@v4

0 commit comments

Comments
 (0)