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

Commit1b8f6ab

Browse files
committed
update _example
1 parent50ec962 commit1b8f6ab

File tree

11 files changed

+556
-10
lines changed

11 files changed

+556
-10
lines changed

‎README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ As a Gopher, i want to create a Golang base workflow quickly than sketching it o
2323
3. Additional patterns
2424
1. Add Github Action release to project.`-s` enable code sign and notarize
2525
1. Add license to project
26+
2. Add Makefile to project
2627
4. Support`arm64` &`amd64`
2728

2829
##Installation
@@ -94,23 +95,22 @@ Use "ak [command] --help" for more information about a command.
9495
```
9596

9697
4. Create one of three different workflow patterns
97-
1. `ak new script` create script feedback
98-
2. `ak new scriptFilter` create scriptFilter items feedback
98+
1. `ak new cmd` create cobra based workflow
9999
5. Add additional components to the workflow
100100
1. `ak add githubAction` add Github Action release to project
101-
1. `-s true` to enable code sign and notarize
101+
1. `-s` to enable code sign and notarize
102102
2. `ak add license` add license to project
103+
3. `ak add makefile` add Makefile to project
103104
6. Workflow development
104-
1. `ak alfred build` to build the workflow executable and output it into the `.workflow` subdirectory
105-
2. `ak alfred info` to display information about the workflow
106-
3. `ak alfred link` to link the `.workflow` subdirectory into Alfred's preferences directory, installing it.
107-
4. `ak alfred package` to package the workflow for distribution locally
108-
5. `ak alfred unlink` to unlink the `.workflow` subdirectory from Alfred's preferences directory, uninstalling it.
105+
1. `make build` to build the workflow executable and output it into the `.workflow` subdirectory
106+
2. `make info` to display information about the workflow
107+
3. `make link` to link the `.workflow` subdirectory into Alfred's preferences directory, installing it.
108+
4. `make package` to package the workflow for distribution locally
109+
5. `make unlink` to unlink the `.workflow` subdirectory from Alfred's preferences directory, uninstalling it.
109110

110111
## Examples
111112

112-
1. [ak/_examples/script](https://github.com/cage1016/ak/tree/master/_examples/script)
113-
2. [ak/_examples/scriptFilter](https://github.com/cage1016/ak/tree/master/_examples/scriptFilter)
113+
1. [ak/_example](https://github.com/cage1016/ak/tree/master/_example)
114114

115115
## License
116116
This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.

‎_example/.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
alfred_workflow_bundleid="com.xxx.aktest"
2+
alfred_workflow_data="./testenv/data"
3+
alfred_workflow_cache="./testenv/cache"
4+
alfred_workflow_version="0.1.0"
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name:Release
2+
on:
3+
release:
4+
types:
5+
-published
6+
7+
jobs:
8+
build:
9+
strategy:
10+
matrix:
11+
go-version:[1.20.x]
12+
platform:[macOS-latest]
13+
runs-on:${{ matrix.platform }}
14+
steps:
15+
-uses:actions/checkout@v2
16+
-name:Install Go
17+
if:success()
18+
uses:actions/setup-go@v2
19+
with:
20+
go-version:${{ matrix.go-version }}
21+
-name:Run unit tests
22+
run:go test -v ./...
23+
-name:Parse Event
24+
run:|
25+
echo "tag=$(jq -r '.release.tag_name' "${GITHUB_EVENT_PATH}" | sed s/^v//)" >> $GITHUB_ENV
26+
-name:Import Code-Signing Certificates
27+
uses:Apple-Actions/import-codesign-certs@v1
28+
with:
29+
# The certificates in a PKCS12 file encoded as a base64 string
30+
p12-file-base64:"${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}"
31+
# The password used to import the PKCS12 file.
32+
p12-password:"${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}"
33+
-name:Install gon via HomeBrew for code signing and app notarization
34+
run:|
35+
brew tap mitchellh/gon
36+
brew install mitchellh/gon/gon
37+
-name:Build and pack
38+
run:|
39+
# build package
40+
GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w" -o exe_amd64
41+
GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w" -o exe_arm64
42+
lipo -create -output .workflow/exe exe_amd64 exe_arm64
43+
rm exe_amd64
44+
rm exe_arm64
45+
-name:code sign and notarize
46+
env:
47+
AC_USERNAME:"${{ secrets.AC_USERNAME }}"
48+
AC_PASSWORD:"${{ secrets.AC_PASSWORD }}"
49+
run:|
50+
# gon code sign
51+
cat <<EOF >> gon.json
52+
{
53+
"source" : [".workflow/exe"],
54+
"bundle_id" : "com.xxx.aktest",
55+
"sign" :{
56+
"application_identity" : ""
57+
}
58+
}
59+
EOF
60+
gon -log-level=debug -log-json ./gon.json
61+
62+
# pack alfredworkflow
63+
cd .workflow
64+
plutil -replace version -string "${{ env.tag }}" info.plist
65+
zip -r ../"AkTest-${{ env.tag }}.alfredworkflow" .
66+
cd ..
67+
68+
# zip alfredworkflow as zip archive for notarize
69+
zip -r "AkTest-${{ env.tag }}.alfredworkflow.zip" "AkTest-${{ env.tag }}.alfredworkflow"
70+
71+
# gon notarize
72+
cat <<EOF >> notarize.json
73+
{
74+
"notarize": [{
75+
"path": "${PWD}/AkTest-${{ env.tag }}.alfredworkflow.zip",
76+
"bundle_id": "com.xxx.aktest",
77+
"staple":false
78+
}]
79+
}
80+
EOF
81+
gon -log-level=debug -log-json ./notarize.json
82+
83+
echo "artifact=$(echo "AkTest-${{ env.tag }}.alfredworkflow")" >> $GITHUB_ENV
84+
-uses:shogo82148/actions-upload-release-asset@v1
85+
with:
86+
upload_url:${{ github.event.release.upload_url }}
87+
asset_path:"${{ env.artifact }}"
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name:Release
2+
on:
3+
release:
4+
types:
5+
-published
6+
7+
jobs:
8+
build:
9+
strategy:
10+
matrix:
11+
go-version:[1.20.x]
12+
platform:[macOS-latest]
13+
runs-on:${{ matrix.platform }}
14+
steps:
15+
-uses:actions/checkout@v2
16+
-name:Install Go
17+
if:success()
18+
uses:actions/setup-go@v2
19+
with:
20+
go-version:${{ matrix.go-version }}
21+
-name:Run unit tests
22+
run:go test -v ./...
23+
-name:Parse Event
24+
run:|
25+
echo "tag=$(jq -r '.release.tag_name' "${GITHUB_EVENT_PATH}" | sed s/^v//)" >> $GITHUB_ENV
26+
-name:Import Code-Signing Certificates
27+
uses:Apple-Actions/import-codesign-certs@v1
28+
with:
29+
# The certificates in a PKCS12 file encoded as a base64 string
30+
p12-file-base64:"${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}"
31+
# The password used to import the PKCS12 file.
32+
p12-password:"${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}"
33+
-name:Install gon via HomeBrew for code signing and app notarization
34+
run:|
35+
brew tap mitchellh/gon
36+
brew install mitchellh/gon/gon
37+
-name:Build and pack
38+
run:|
39+
# build package
40+
GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X github.com/xxx/ak-test/cmd.EnabledAutoUpdate=true" -o exe_amd64
41+
GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X github.com/xxx/ak-test/cmd.EnabledAutoUpdate=true" -o exe_arm64
42+
lipo -create -output .workflow/exe exe_amd64 exe_arm64
43+
rm exe_amd64
44+
rm exe_arm64
45+
-name:code sign and notarize
46+
env:
47+
AC_USERNAME:"${{ secrets.AC_USERNAME }}"
48+
AC_PASSWORD:"${{ secrets.AC_PASSWORD }}"
49+
run:|
50+
# gon code sign
51+
cat <<EOF >> gon.json
52+
{
53+
"source" : [".workflow/exe"],
54+
"bundle_id" : "com.xxx.aktest",
55+
"sign" :{
56+
"application_identity" : ""
57+
}
58+
}
59+
EOF
60+
gon -log-level=debug -log-json ./gon.json
61+
62+
# pack alfredworkflow
63+
cd .workflow
64+
plutil -replace version -string "${{ env.tag }}" info.plist
65+
zip -r ../"AkTest_auto_update-${{ env.tag }}.alfredworkflow" .
66+
cd ..
67+
68+
# zip alfredworkflow as zip archive for notarize
69+
zip -r "AkTest_auto_update-${{ env.tag }}.alfredworkflow.zip" "AkTest_auto_update-${{ env.tag }}.alfredworkflow"
70+
71+
# gon notarize
72+
cat <<EOF >> notarize.json
73+
{
74+
"notarize": [{
75+
"path": "${PWD}/AkTest_auto_update-${{ env.tag }}.alfredworkflow.zip",
76+
"bundle_id": "com.xxx.aktest",
77+
"staple":false
78+
}]
79+
}
80+
EOF
81+
gon -log-level=debug -log-json ./notarize.json
82+
83+
echo "artifact=$(echo "AkTest_auto_update-${{ env.tag }}.alfredworkflow")" >> $GITHUB_ENV
84+
-uses:shogo82148/actions-upload-release-asset@v1
85+
with:
86+
upload_url:${{ github.event.release.upload_url }}
87+
asset_path:"${{ env.artifact }}"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp