diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..bdc5a7922d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,54 @@ +name: release + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Set up Golang env + uses: actions/setup-go@v2 + with: + go-version: 1.17 + id: go + + - name: checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + persist-credentials: false # <--- this + + - name: compile binary + run: make all-arch + + - name : Upload artifact bin + uses: actions/upload-artifact@v2 + with: + name: chain33-artifact + path: build/*.tar + + - name: Semantic Release + uses: cycjimmy/semantic-release-action@v2 + id: semantic + with: + branch: master + extra_plugins: | + @semantic-release/changelog + @semantic-release/git + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + + - name: Do something when a new release published + if: steps.semantic.outputs.new_release_published == 'true' + run: | + echo ${{ steps.semantic.outputs.new_release_version }} + echo ${{ steps.semantic.outputs.new_release_major_version }} + echo ${{ steps.semantic.outputs.new_release_minor_version }} + echo ${{ steps.semantic.outputs.new_release_patch_version }} + + diff --git a/.releaserc.yml b/.releaserc.yml new file mode 100644 index 0000000000..90c65a994d --- /dev/null +++ b/.releaserc.yml @@ -0,0 +1,17 @@ +{ "branches": ["master", "next"], + "plugins": [ + "@semantic-release/commit-analyzer", #Default 1 + "@semantic-release/release-notes-generator", #Default 2 + [ + "@semantic-release/changelog", + { "changelogFile": "CHANGELOG.md", "changelogTitle": "changelog" }, + ], + # "@semantic-release/npm", #Default 3 + # "@semantic-release/github", #Default 4 + [ + "@semantic-release/github", + {"assets": ["build/*.tar"]} + ], + "@semantic-release/git", + ] +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Makefile b/Makefile index 2401793174..27bacde596 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,48 @@ build_ci: depends ## Build the binary file for CI @cp chain33.para.toml build/ci/paracross/ +PLATFORM_LIST = \ + darwin-amd64 \ + darwin-arm64 \ + linux-amd64 \ + +WINDOWS_ARCH_LIST = \ + windows-amd64 + +GOBUILD=go build $(BUILD_FLAGS) $(LDFLAGS) + +darwin-amd64: + GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(APP)-$@ $(SRC) + GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(CLI)-$@ $(SRC_CLI) + cp chain33.para.toml chain33.toml build/ && cd build && \ + chmod +x chain33-darwin-amd64 && \ + chmod +x chain33-cli-darwin-amd64 && \ + tar -zcvf chain33-darwin-amd64.tar chain33-darwin-amd64 chain33-cli-darwin-amd64 chain33.para.toml chain33.toml + +darwin-arm64: + GOARCH=arm64 GOOS=darwin $(GOBUILD) -o $(APP)-$@ $(SRC) + GOARCH=arm64 GOOS=darwin $(GOBUILD) -o $(CLI)-$@ $(SRC_CLI) + cp chain33.para.toml chain33.toml build/ && cd build && \ + chmod +x chain33-darwin-arm64 && \ + chmod +x chain33-cli-darwin-arm64 && \ + tar -zcvf chain33-darwin-arm64.tar chain33-darwin-arm64 chain33-cli-darwin-arm64 chain33.toml chain33.para.toml + +linux-amd64: + GOARCH=amd64 GOOS=linux $(GOBUILD) -o $(APP)-$@ $(SRC) + GOARCH=amd64 GOOS=linux $(GOBUILD) -o $(CLI)-$@ $(SRC_CLI) + cp chain33.para.toml chain33.toml build/ && cd build && \ + chmod +x chain33-linux-amd64 && \ + chmod +x chain33-cli-linux-amd64 && \ + tar -zcvf chain33-linux-amd64.tar chain33-linux-amd64 chain33-cli-linux-amd64 chain33.para.toml chain33.toml + +windows-amd64: + GOARCH=amd64 GOOS=windows $(GOBUILD) -o $(APP)-$@.exe $(SRC) + GOARCH=amd64 GOOS=windows $(GOBUILD) -o $(CLI)-$@.exe $(SRC_CLI) + cp chain33.para.toml chain33.toml build/ && cd build && \ + tar -zcvf chain33-windows-amd64.tar chain33-windows-amd64.exe chain33-cli-windows-amd64.exe chain33.para.toml chain33.toml + +all-arch: $(PLATFORM_LIST) $(WINDOWS_ARCH_LIST) + para: @go build -v -o build/$(NAME) -ldflags "-X $(SRC_CLI)/buildflags.ParaName=user.p.$(NAME). -X $(SRC_CLI)/buildflags.RPCAddr=http://localhost:8901" $(SRC_CLI)