Commit 72ab4fdf authored by suyanlong's avatar suyanlong Committed by mdj33

fix: 🐛version control: Add github action for auto publish release and tag version

parent 8d54779f
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 }}
{ "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",
]
}
...@@ -32,6 +32,48 @@ build_ci: depends ## Build the binary file for CI ...@@ -32,6 +32,48 @@ build_ci: depends ## Build the binary file for CI
@cp chain33.para.toml build/ci/paracross/ @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: 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) @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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment