Skip to content

Commit

Permalink
fix: šŸ›version control: Add github action for auto publish release andā€¦
Browse files Browse the repository at this point in the history
ā€¦ tag version
  • Loading branch information
suyanlong authored and mdj33 committed Oct 16, 2021
1 parent 8d54779 commit 72ab4fd
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
17 changes: 17 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -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",
]
}
Empty file added CHANGELOG.md
Empty file.
42 changes: 42 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 72ab4fd

Please sign in to comment.