Skip to content

Commit d7e0c84

Browse files
committed
fix(app): Use new action for checking which branch belong commit with tag
1 parent f59460f commit d7e0c84

2 files changed

Lines changed: 17 additions & 22 deletions

File tree

.github/workflows/build.yaml

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,33 +51,28 @@ jobs:
5151
steps:
5252
- name: Checkout
5353
uses: actions/checkout@v3
54-
- name: Check which branch belong commit with tag
55-
id: check-branch
56-
run: |
57-
onMainBranch=false
58-
onDevelopBranch=false
59-
branches=$(git branch -r --contains tags/$GITHUB_REF_NAME)
60-
for branch in $branches; do
61-
if [[ $branch == "origin/main" ]]; then
62-
onMainBranch=true
63-
fi
64-
if [[ $branch == "origin/develop" ]]; then
65-
onDevelopBranch=true
66-
fi
67-
done
68-
echo "onMainBranch=$onMainBranch" >> $GITHUB_OUTPUT
69-
echo "onDevelopBranch=$onDevelopBranch" >> $GITHUB_OUTPUT
70-
echo $onMainBranch
71-
echo $onDevelopBranch
72-
shell: bash
54+
with:
55+
fetch-depth: 0
56+
- name: Check if tag belong to commit in main branch
57+
uses: rickstaa/action-contains-tag@v1
58+
id: contains_tag_main
59+
with:
60+
reference: "main"
61+
tag: "${{ github.ref }}"
62+
- name: Check if tag belong to commit in develop branch
63+
uses: rickstaa/action-contains-tag@v1
64+
id: contains_tag_develop
65+
with:
66+
reference: "develop"
67+
tag: "${{ github.ref }}"
7368
- name: Release
7469
uses: softprops/action-gh-release@v1
7570
with:
7671
generate_release_notes: true
77-
if: ${{ steps.check-branch.outputs.onMainBranch == 'true'}}
72+
if: ${{ steps.contains_tag_main.outputs.retval == 'true'}}
7873
- name: Pre-Release
7974
uses: softprops/action-gh-release@v1
8075
with:
8176
prerelease: true
8277
generate_release_notes: true
83-
if: ${{ steps.check-branch.outputs.onDevelopBranch == 'true'}}
78+
if: ${{ steps.contains_tag_develop.outputs.retval == 'true'}}

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func main() {
4242
}
4343
servingAt := servingAddress + ":" + servingPort
4444
logger.Info("Start serving http request...", zap.String("address", servingAt))
45-
//Start app forever
45+
//Start app
4646
err := http.ListenAndServe(servingAt, mux)
4747
if err != nil {
4848
logger.Error("Fail to start http server", zap.String("err", err.Error()))

0 commit comments

Comments
 (0)