Skip to content

Commit c60a278

Browse files
committed
up --pre-release
1 parent 98d28c7 commit c60a278

File tree

6 files changed

+87
-1
lines changed

6 files changed

+87
-1
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/sh
2+
3+
pull_and_rebase() {
4+
# Get the current branch name
5+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
6+
7+
# Check if the remote branch exists
8+
if git show-ref --quiet --verify "refs/remotes/origin/$CURRENT_BRANCH"; then
9+
# Remote branch exists, attempt to pull with rebase
10+
if ! git pull origin "$CURRENT_BRANCH" --rebase; then
11+
echo "Rebase failed. Attempting to abort the rebase."
12+
if git rebase --abort; then
13+
echo "Rebase aborted. Please resolve conflicts or merge changes manually."
14+
else
15+
echo "No rebase in progress. Please check the status of the repository."
16+
fi
17+
exit 1
18+
fi
19+
else
20+
echo "Remote branch does not exist. Skipping pull."
21+
fi
22+
}
23+
24+
commit_and_push() {
25+
COMMIT_MSG=$1
26+
# Commit and push
27+
git commit -m "$COMMIT_MSG" --allow-empty
28+
if ! git push origin "$(git rev-parse --abbrev-ref HEAD)"; then
29+
echo "Push failed. Please check for any issues and try again."
30+
exit 1
31+
fi
32+
}
33+
34+
35+
commit_automatic_trigger() {
36+
COMMIT_MSG=$1
37+
# Check for staged changes
38+
if git diff --cached --quiet; then
39+
# No changes staged, proceed with an empty commit
40+
git commit --allow-empty -m "$COMMIT_MSG"
41+
echo "Trigger commit created."
42+
else
43+
# Staged changes detected, fail the script
44+
echo "Error: Staged changes detected. Cannot proceed with trigger commit."
45+
exit 1
46+
fi
47+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
# Determine the directory where the script is located
4+
SCRIPT_DIR=$(dirname "$(realpath "$0")")
5+
6+
# Source the utils script from the same directory as trigger-auto
7+
. "$SCRIPT_DIR/git-operations"
8+
9+
10+
commit_automatic_trigger "$* --pre-release --build"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
# Determine the directory where the script is located
4+
SCRIPT_DIR=$(dirname "$(realpath "$0")")
5+
6+
# Source the utils script from the same directory as trigger-auto
7+
. "$SCRIPT_DIR/git-operations"
8+
9+
pull_and_rebase
10+
commit_and_push "$* --pre-release --build"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
# Determine the directory where the script is located
4+
SCRIPT_DIR=$(dirname "$(realpath "$0")")
5+
6+
# Source the utils script from the same directory as trigger-auto
7+
. "$SCRIPT_DIR/git-operations"
8+
9+
pull_and_rebase
10+
commit_and_push "$* --build"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
# Determine the directory where the script is located
4+
SCRIPT_DIR=$(dirname "$(realpath "$0")")
5+
6+
# Source the utils script from the same directory as trigger-auto
7+
. "$SCRIPT_DIR/git-operations"
8+
9+
pull_and_rebase
10+
commit_and_push "$* --pre-release --debug"

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
FROM golang:1.17.3@sha256:b5bfe0255e6fac7cec1abd091b5cc3a5c40e2ae4d09bafbe5e94cb705647f0fc as builder
22

33
ARG TARGETARCH
4-
54
ENV GO111MODULE=on \
65
CGO_ENABLED=0 \
76
GOARCH=${TARGETARCH} \

0 commit comments

Comments
 (0)