1616 id : app-token
1717 uses : actions/create-github-app-token@v1
1818 with :
19- app-id : \ ${{ vars.RUBRION_APP_ID }}
20- private-key : \ ${{ secrets.RUBRION_APP_SECRET }}
19+ app-id : ${{ vars.RUBRION_APP_ID }}
20+ private-key : ${{ secrets.RUBRION_APP_SECRET }}
2121
2222 - name : Set Git User Identity
2323 run : |
@@ -29,19 +29,25 @@ jobs:
2929 with :
3030 fetch-depth : 0
3131 ref : develop
32- token : \ ${{ steps.app-token.outputs.token }}
32+ token : ${{ steps.app-token.outputs.token }}
3333
3434 - name : Ensure Develop is Up to Date
3535 run : |
3636 git fetch origin develop
3737 git checkout develop
3838 git pull origin develop
3939
40- - name : Merge Develop into Main
40+ - name : Check if Main Branch Exists and Merge
4141 run : |
42- git checkout main
43- git merge --no-ff develop
44- git push origin main
42+ if git ls-remote --heads origin main | grep main; then
43+ echo "Main branch exists, proceeding with merge"
44+ git checkout main || git checkout -b main
45+ git merge --no-ff develop -m "chore: merge develop into main for release v${VERSION}"
46+ else
47+ echo "Main branch does not exist, creating from develop"
48+ git checkout -b main
49+ fi
50+ git push -u origin main
4551
4652 - name : Setup Node.js
4753 uses : actions/setup-node@v4
@@ -51,15 +57,15 @@ jobs:
5157 - name : Determine Release Version
5258 id : version
5359 run : |
54- if [ -n "\ ${{ github.event.inputs.release_version }}" ]; then
55- VERSION=\ ${{ github.event.inputs.release_version }}
60+ if [ -n "${{ github.event.inputs.release_version }}" ]; then
61+ VERSION=${{ github.event.inputs.release_version }}
5662 else
57- LAST_TAG=\ $(git tag --sort=-v:refname | head -n 1 | sed 's/v//')
58- IFS='.' read -r major minor patch <<< "\ $LAST_TAG"
59- VERSION="\ $major.\ $minor.\ $((patch + 1))"
63+ LAST_TAG=$(git tag --sort=-v:refname | head -n 1 | sed 's/v//')
64+ IFS='.' read -r major minor patch <<< "$LAST_TAG"
65+ VERSION="$major.$minor.$((patch + 1))"
6066 fi
61- echo "VERSION=\ $VERSION" >> \ $GITHUB_ENV
62- echo "Release version set to \ $VERSION"
67+ echo "VERSION=$VERSION" >> $GITHUB_ENV
68+ echo "Release version set to $VERSION"
6369
6470 - name : Verify Version in Code
6571 run : |
8591
8692 - name : Create Git Tag
8793 run : |
88- git tag "v\ ${VERSION}"
94+ git tag "v${VERSION}"
8995 git push origin --tags
9096
9197 - name : Set Up Go
@@ -95,31 +101,31 @@ jobs:
95101
96102 - name : Build Cross-Platform Binaries
97103 run : |
98- if [ -z "\ ${{ vars.PROJECT_NAME }}" ]; then
104+ if [ -z "${{ vars.PROJECT_NAME }}" ]; then
99105 echo "ERROR: PROJECT_NAME GitHub variable is not set. Please set it in repository settings."
100106 exit 1
101107 fi
102108
103- PROJECT_NAME="\ ${{ vars.PROJECT_NAME }}"
104- echo "Using project name: \ $PROJECT_NAME"
109+ PROJECT_NAME="${{ vars.PROJECT_NAME }}"
110+ echo "Using project name: $PROJECT_NAME"
105111
106112 go mod tidy
107- echo "Building CLI for version \ $VERSION"
113+ echo "Building CLI for version $VERSION"
108114 mkdir -p dist
109115
110- GOOS=linux GOARCH=amd64 go build -o dist/\ $PROJECT_NAME-linux -ldflags="-X '\ $PROJECT_NAME/commands.CurrentVersion=\ ${VERSION}'" main.go || exit 1
111- GOOS=windows GOARCH=amd64 go build -o dist/\ $PROJECT_NAME.exe -ldflags="-X '\ $PROJECT_NAME/commands.CurrentVersion=\ ${VERSION}'" main.go || exit 1
112- GOOS=darwin GOARCH=amd64 go build -o dist/\ $PROJECT_NAME-mac -ldflags="-X '\ $PROJECT_NAME/commands.CurrentVersion=\ ${VERSION}'" main.go || exit 1
116+ GOOS=linux GOARCH=amd64 go build -o dist/$PROJECT_NAME-linux -ldflags="-X '$PROJECT_NAME/commands.CurrentVersion=${VERSION}'" main.go || exit 1
117+ GOOS=windows GOARCH=amd64 go build -o dist/$PROJECT_NAME.exe -ldflags="-X '$PROJECT_NAME/commands.CurrentVersion=${VERSION}'" main.go || exit 1
118+ GOOS=darwin GOARCH=amd64 go build -o dist/$PROJECT_NAME-mac -ldflags="-X '$PROJECT_NAME/commands.CurrentVersion=${VERSION}'" main.go || exit 1
113119
114120 echo "Build completed. Contents of dist/:"
115121 ls -lh dist/
116122
117123 - name : Create GitHub Release
118124 run : |
119- PROJECT_NAME="\ ${{ vars.PROJECT_NAME }}"
120- gh release create "v\ ${VERSION}" \
121- --title "Release v\ ${VERSION}" \
125+ PROJECT_NAME="${{ vars.PROJECT_NAME }}"
126+ gh release create "v${VERSION}" \
127+ --title "Release v${VERSION}" \
122128 --notes-file CHANGELOG.md \
123- dist/\ $PROJECT_NAME-linux dist/\ $PROJECT_NAME.exe dist/\ $PROJECT_NAME-mac
129+ dist/$PROJECT_NAME-linux dist/$PROJECT_NAME.exe dist/$PROJECT_NAME-mac
124130 env :
125- GH_TOKEN : \ ${{ secrets.GITHUB_TOKEN }}
131+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments