Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7021975

Browse files
committed
refactor(template): import partials template
1 parent5e46be8 commit7021975

File tree

10 files changed

+251
-143
lines changed

10 files changed

+251
-143
lines changed

‎_example/.github/workflows/release.yml

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,35 @@ jobs:
1313
runs-on:${{ matrix.platform }}
1414
steps:
1515
-uses:actions/checkout@v2
16+
-name:Parse Event
17+
run:|
18+
echo "tag=$(jq -r '.release.tag_name' "${GITHUB_EVENT_PATH}" | sed s/^v//)" >> $GITHUB_ENV
1619
-name:Install Go
1720
if:success()
1821
uses:actions/setup-go@v2
1922
with:
2023
go-version:${{ matrix.go-version }}
2124
-name:Run unit tests
22-
go test -v -race -cover -coverprofile coverage.txt -covermode=atomic ./...
25+
run:go test -v -race -cover -coverprofile coverage.txt -covermode=atomic ./...
2326
-name:update codecov
2427
run:|
25-
CODECOV_TOKEN="${{ secrets.CODECOV_TOKEN }}" bash <(curl -s https://codecov.io/bash)
26-
-name:Parse Event
28+
CODECOV_TOKEN="${{ secrets.CODECOV_TOKEN }}" bash <(curl -s https://codecov.io/bash)
29+
-name:Build and pack
2730
run:|
28-
echo "tag=$(jq -r '.release.tag_name' "${GITHUB_EVENT_PATH}" | sed s/^v//)" >> $GITHUB_ENV
31+
# build package
32+
GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X github.com/xxx/ak-test/cmd.EnabledAutoUpdate=false" -o exe_amd64
33+
GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X github.com/xxx/ak-test/cmd.EnabledAutoUpdate=false" -o exe_arm64
34+
lipo -create -output .workflow/exe exe_amd64 exe_arm64
35+
rm exe_amd64
36+
rm exe_arm64
37+
38+
# pack
39+
cd .workflow
40+
plutil -replace version -string "${{ env.tag }}" info.plist
41+
zip -r ../"AkTest-${{ env.tag }}.alfredworkflow_" .
42+
cd ..
43+
44+
echo "artifact=$(echo "AkTest-${{ env.tag }}.alfredworkflow_")" >> $GITHUB_ENV
2945
-name:Import Code-Signing Certificates
3046
uses:Apple-Actions/import-codesign-certs@v1
3147
with:
@@ -37,14 +53,6 @@ jobs:
3753
run:|
3854
brew tap mitchellh/gon
3955
brew install mitchellh/gon/gon
40-
-name:Build and pack
41-
run:|
42-
# build package
43-
GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X github.com/xxx/ak-test/cmd.EnabledAutoUpdate=false" -o exe_amd64
44-
GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X github.com/xxx/ak-test/cmd.EnabledAutoUpdate=false" -o exe_arm64
45-
lipo -create -output .workflow/exe exe_amd64 exe_arm64
46-
rm exe_amd64
47-
rm exe_arm64
4856
-name:code sign and notarize
4957
env:
5058
AC_USERNAME:"${{ secrets.AC_USERNAME }}"
@@ -61,16 +69,16 @@ jobs:
6169
}
6270
EOF
6371
gon -log-level=debug -log-json ./gon.json
64-
72+
6573
# pack alfredworkflow
6674
cd .workflow
6775
plutil -replace version -string "${{ env.tag }}" info.plist
6876
zip -r ../"AkTest-${{ env.tag }}.alfredworkflow_" .
6977
cd ..
70-
78+
7179
# zip alfredworkflow as zip archive for notarize
7280
zip -r "AkTest-${{ env.tag }}.alfredworkflow.zip" "AkTest-${{ env.tag }}.alfredworkflow_"
73-
81+
7482
# gon notarize
7583
cat <<EOF >> notarize.json
7684
{
@@ -82,8 +90,8 @@ jobs:
8290
}
8391
EOF
8492
gon -log-level=debug -log-json ./notarize.json
85-
86-
echo "artifact=$(echo "AkTest-${{ env.tag }}.alfredworkflow_")" >> $GITHUB_ENV
93+
94+
echo "artifact=$(echo "AkTest-${{ env.tag }}.alfredworkflow_")" >> $GITHUB_ENV
8795
-uses:shogo82148/actions-upload-release-asset@v1
8896
with:
8997
upload_url:${{ github.event.release.upload_url }}

‎_example/.github/workflows/release_auto_update.yml

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,35 @@ jobs:
1313
runs-on:${{ matrix.platform }}
1414
steps:
1515
-uses:actions/checkout@v2
16+
-name:Parse Event
17+
run:|
18+
echo "tag=$(jq -r '.release.tag_name' "${GITHUB_EVENT_PATH}" | sed s/^v//)" >> $GITHUB_ENV
1619
-name:Install Go
1720
if:success()
1821
uses:actions/setup-go@v2
1922
with:
2023
go-version:${{ matrix.go-version }}
2124
-name:Run unit tests
22-
go test -v -race -cover -coverprofile coverage.txt -covermode=atomic ./...
25+
run:go test -v -race -cover -coverprofile coverage.txt -covermode=atomic ./...
2326
-name:update codecov
2427
run:|
25-
CODECOV_TOKEN="${{ secrets.CODECOV_TOKEN }}" bash <(curl -s https://codecov.io/bash)
26-
-name:Parse Event
28+
CODECOV_TOKEN="${{ secrets.CODECOV_TOKEN }}" bash <(curl -s https://codecov.io/bash)
29+
-name:Build and pack
2730
run:|
28-
echo "tag=$(jq -r '.release.tag_name' "${GITHUB_EVENT_PATH}" | sed s/^v//)" >> $GITHUB_ENV
31+
# build package
32+
GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X github.com/xxx/ak-test/cmd.EnabledAutoUpdate=true" -o exe_amd64
33+
GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X github.com/xxx/ak-test/cmd.EnabledAutoUpdate=true" -o exe_arm64
34+
lipo -create -output .workflow/exe exe_amd64 exe_arm64
35+
rm exe_amd64
36+
rm exe_arm64
37+
38+
# pack
39+
cd .workflow
40+
plutil -replace version -string "${{ env.tag }}" info.plist
41+
zip -r ../"AkTest_auto_update-${{ env.tag }}.alfredworkflow" .
42+
cd ..
43+
44+
echo "artifact=$(echo "AkTest_auto_update-${{ env.tag }}.alfredworkflow")" >> $GITHUB_ENV
2945
-name:Import Code-Signing Certificates
3046
uses:Apple-Actions/import-codesign-certs@v1
3147
with:
@@ -37,14 +53,6 @@ jobs:
3753
run:|
3854
brew tap mitchellh/gon
3955
brew install mitchellh/gon/gon
40-
-name:Build and pack
41-
run:|
42-
# build package
43-
GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X github.com/xxx/ak-test/cmd.EnabledAutoUpdate=true" -o exe_amd64
44-
GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X github.com/xxx/ak-test/cmd.EnabledAutoUpdate=true" -o exe_arm64
45-
lipo -create -output .workflow/exe exe_amd64 exe_arm64
46-
rm exe_amd64
47-
rm exe_arm64
4856
-name:code sign and notarize
4957
env:
5058
AC_USERNAME:"${{ secrets.AC_USERNAME }}"
@@ -61,16 +69,16 @@ jobs:
6169
}
6270
EOF
6371
gon -log-level=debug -log-json ./gon.json
64-
72+
6573
# pack alfredworkflow
6674
cd .workflow
6775
plutil -replace version -string "${{ env.tag }}" info.plist
6876
zip -r ../"AkTest_auto_update-${{ env.tag }}.alfredworkflow" .
6977
cd ..
70-
78+
7179
# zip alfredworkflow as zip archive for notarize
7280
zip -r "AkTest_auto_update-${{ env.tag }}.alfredworkflow.zip" "AkTest_auto_update-${{ env.tag }}.alfredworkflow"
73-
81+
7482
# gon notarize
7583
cat <<EOF >> notarize.json
7684
{
@@ -82,8 +90,8 @@ jobs:
8290
}
8391
EOF
8492
gon -log-level=debug -log-json ./notarize.json
85-
86-
echo "artifact=$(echo "AkTest_auto_update-${{ env.tag }}.alfredworkflow")" >> $GITHUB_ENV
93+
94+
echo "artifact=$(echo "AkTest_auto_update-${{ env.tag }}.alfredworkflow")" >> $GITHUB_ENV
8795
-uses:shogo82148/actions-upload-release-asset@v1
8896
with:
8997
upload_url:${{ github.event.release.upload_url }}

‎cmd/githubAction.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ var githubActionCmd = &cobra.Command{
1818
Run:func(cmd*cobra.Command,args []string) {
1919
s,_:=cmd.Flags().GetBool("sign")
2020
c,_:=cmd.Flags().GetBool("codecov")
21+
g,_:=cmd.Flags().GetBool("golang")
2122

2223
iferr:=generator.NewGithubActionGenerator(
2324
generator.WithEnabled_Code_Sign_Notarize(s),
2425
generator.WithEnabled_Codecov(c),
26+
generator.WithEnabled_Golang(g),
2527
).Generate();err!=nil {
2628
logrus.Fatal(err)
2729
}
@@ -32,4 +34,5 @@ func init() {
3234
addCmd.AddCommand(githubActionCmd)
3335
githubActionCmd.PersistentFlags().BoolP("sign","s",false,"enable code sign and notarize")
3436
githubActionCmd.PersistentFlags().BoolP("codecov","c",false,"enable codecov")
37+
githubActionCmd.PersistentFlags().BoolP("golang","g",false,"enable goland")
3538
}

‎generator/githubactions.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
typeGithubActionGeneratorstruct {
1919
Enabled_Code_Sign_Notarizebool
2020
Enabled_Codecovbool
21+
Enabled_Golangbool
2122
}
2223

2324
funcWithEnabled_Code_Sign_Notarize(enabledbool)func(*GithubActionGenerator) {
@@ -32,6 +33,12 @@ func WithEnabled_Codecov(enabled bool) func(*GithubActionGenerator) {
3233
}
3334
}
3435

36+
funcWithEnabled_Golang(enabledbool)func(*GithubActionGenerator) {
37+
returnfunc(g*GithubActionGenerator) {
38+
g.Enabled_Golang=enabled
39+
}
40+
}
41+
3542
func (gg*GithubActionGenerator)Generate()error {
3643
te:=template.NewEngine()
3744
defaultFs:=fs.Get()
@@ -48,6 +55,7 @@ func (gg *GithubActionGenerator) Generate() error {
4855
"ReleaseName":"Release",
4956
"EnabledCodeSign":gg.Enabled_Code_Sign_Notarize,
5057
"EnabledCodecov":gg.Enabled_Codecov,
58+
"EnabledGolang":gg.Enabled_Golang,
5159
"WorkflowName":strings.ReplaceAll(viper.GetString("workflow.name")," ",""),
5260
"Ldflags":fmt.Sprintf("-X %s/cmd.EnabledAutoUpdate=false",viper.GetString("go_mod_package")),
5361
"BundleID":viper.GetString("workflow.bundle_id"),
@@ -71,6 +79,7 @@ func (gg *GithubActionGenerator) Generate() error {
7179
"ReleaseName":"Release_auto_update",
7280
"EnabledCodeSign":gg.Enabled_Code_Sign_Notarize,
7381
"EnabledCodecov":gg.Enabled_Codecov,
82+
"EnabledGolang":gg.Enabled_Golang,
7483
"WorkflowName":fmt.Sprintf("%s_auto_update",strings.ReplaceAll(viper.GetString("workflow.name")," ","")),
7584
"Ldflags":fmt.Sprintf("-X %s/cmd.EnabledAutoUpdate=true",viper.GetString("go_mod_package")),
7685
"BundleID":viper.GetString("workflow.bundle_id"),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp