Skip to content

Commit

Permalink
ci: Test semantic-release
Browse files Browse the repository at this point in the history
  • Loading branch information
nadeesha committed Oct 25, 2021
1 parent 0a1db3d commit 46df81a
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/publish-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ jobs:
goarch: ${{ matrix.goarch }}
goversion: "https://dl.google.com/go/go1.16.6.linux-amd64.tar.gz"
extra_files: LICENSE README.md
ldflags: -X "main.appVersion=${{ env.APP_VERSION }}" -X "main.buildTime=${{ env.BUILD_TIME }}" -X main.gitCommit=${{ github.sha }} -X main.gitRef=${{ github.ref }}
17 changes: 5 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,11 @@ jobs:
- name: Build
run: |
make build
- name: "Build Changelog"
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
commitMode: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
uses: actions/create-release@v1
with:
tag_name: v${{ github.run_number }}
release_name: v${{ github.run_number }}
body: ${{steps.github_release.outputs.changelog}}
node-version: "lts/*"
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make setup_semantic_release && npx semantic-release
16 changes: 16 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/github",
{
"assets": "bin/*"
}
],
"@semantic-release/changelog"
],
"branches": [
"main"
]
}
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ run:
go run main.go

build:
go build -o bin/cli main.go
./build.sh

setup_semantic_release:
npm i @semantic-release/commit-analyzer @semantic-release/release-notes-generator @semantic-release/github @semantic-release/changelog
Binary file removed bin/cli
Binary file not shown.
22 changes: 22 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

package_name="cloudstate-cli"

platforms=("windows/amd64" "windows/386" "darwin/amd64" "linux/amd64" "linux/386")

for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
output_name=$package_name'-'$GOOS'-'$GOARCH
if [ $GOOS = "windows" ]; then
output_name+='.exe'
fi

env GOOS=$GOOS GOARCH=$GOARCH go build -o bin/$output_name $package
if [ $? -ne 0 ]; then
echo 'An error has occurred! Aborting the script execution...'
exit 1
fi
done

0 comments on commit 46df81a

Please sign in to comment.