Skip to content

Commit

Permalink
Merge pull request #1621 from cpunion/v1.2-release-action
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei authored Jan 11, 2024
2 parents c6539a5 + bc2dd28 commit 86242de
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 11 deletions.
30 changes: 19 additions & 11 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release Build
on:
push:
tags:
- "v*.*.*"
- "v*"

jobs:
build:
Expand All @@ -18,21 +18,29 @@ jobs:
echo Current tag: $tag_name
git checkout $tag_name
echo "TAG_NAME=${tag_name}" >> $GITHUB_ENV
- name: Check VERSION consistency
run: |
tag=$(git describe --tags --dirty)
version=$(cat VERSION)
if [ "$tag" != "$version" ]; then
echo "VERSION file is not consistent with tag name"
echo "VERSION: $version"
echo "TAG: $tag"
exit 1
fi
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.18
go-version: "1.21"

- name: Build
- name: Install goreleaser
run: |
make dist
go install github.com/goreleaser/goreleaser@latest
- name: Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.TAG_NAME }}
file: ./build-dir/gop-*.zip
file_glob: true
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WINGET_PKGS_PRIVATE_KEY: ${{ secrets.WINGET_PKGS_PRIVATE_KEY }}
run: goreleaser release -p 4
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@ cmd/qfmt/qfmt
bin/
go-num/
_todo*.go

dist/
103 changes: 103 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 1

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
# - go generate ./...

builds:
- id: gop
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
main: ./cmd/gop
binary: bin/gop
ldflags:
- -X github.com/goplus/gop/env.buildVersion=v{{.Version}}
- -X github.com/goplus/gop/env.buildDate={{.Date}}
- id: gopfmt
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
main: ./cmd/gopfmt
binary: bin/gopfmt
ldflags:
- -X github.com/goplus/gop/env.buildVersion=v{{.Version}}
- -X github.com/goplus/gop/env.buildDate={{.Date}}

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_v{{.Version}}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip
files:
- LICENSE
- "*.mod"
- "*.sum"
- "*.md"
- "**/*.go"
- "**/*.md"

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

winget:
- name: gop
homepage: "https://goplus.org/"
publisher: goplus
publisher_url: https://github.com/goplus/gop
publisher_support_url: "https://github.com/goplus/gop/issues/new"
package_identifier: goplus.gop
short_description: The Go+ Programming Language
description: |
The Go+ programming language is designed for engineering, STEM education, and data science.
- For engineering: working in the simplest language that can be mastered by children.
- For STEM education: studying an engineering language that can be used for work in the future.
- For data science: communicating with engineers in the same language.
license: Apache-2.0
skip_upload: false
release_notes: "{{.Changelog}}"
release_notes_url: "https://github.com/goplus/gop/releases/tag/v{{.Version}}"
dependencies:
- package_identifier: GoLang.Go
minimum_version: 1.18.0
repository:
owner: goplus
name: winget-pkgs
branch: "{{.ProjectName}}-v{{.Version}}"
git:
url: "git@github.com:goplus/winget-pkgs.git"
private_key: "{{ .Env.WINGET_PKGS_PRIVATE_KEY }}"
pull_request:
enabled: true
draft: false
base:
owner: microsoft
name: winget-pkgs
branch: master

0 comments on commit 86242de

Please sign in to comment.