v1.7.3 #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Gallery Release | |
on: | |
release: | |
types: | |
- published | |
jobs: | |
build: | |
strategy: | |
matrix: | |
go-version: [1.17.x] | |
platform: [macOS-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Parse Event | |
run: | | |
echo "tag=$(jq -r '.release.tag_name' "${GITHUB_EVENT_PATH}" | sed s/^v//)" >> $GITHUB_ENV | |
- name: Install Go | |
if: success() | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Run unit tests | |
run: go test -v -race -cover -coverprofile coverage.txt -covermode=atomic ./... | |
- name: update codecov | |
run: | | |
CODECOV_TOKEN="${{ secrets.CODECOV_TOKEN }}" bash <(curl -s https://codecov.io/bash) | |
- name: Build and pack | |
run: | | |
# build package | |
GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X github.com/cage1016/alfred-devtoys/cmd.EnabledAutoUpdate=false" -o exe_amd64 | |
GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X github.com/cage1016/alfred-devtoys/cmd.EnabledAutoUpdate=false" -o exe_arm64 | |
lipo -create -output .workflow/exe exe_amd64 exe_arm64 | |
rm exe_amd64 | |
rm exe_arm64 | |
# pack | |
cd .workflow | |
plutil -replace version -string "${{ env.tag }}" info.plist | |
zip -r ../"DevToys_GALLERY-${{ env.tag }}.alfredworkflow" . | |
cd .. | |
echo "artifact=$(echo "DevToys_GALLERY-${{ env.tag }}.alfredworkflow")" >> $GITHUB_ENV | |
- name: Import Code-Signing Certificates | |
uses: Apple-Actions/import-codesign-certs@v1 | |
with: | |
# The certificates in a PKCS12 file encoded as a base64 string | |
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }} | |
# The password used to import the PKCS12 file. | |
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }} | |
- name: Install gon via HomeBrew for code signing and app notarization | |
run: | | |
brew tap mitchellh/gon | |
brew install mitchellh/gon/gon | |
- name: code sign and notarize | |
env: | |
AC_USERNAME: ${{ secrets.AC_USERNAME }} | |
AC_PASSWORD: ${{ secrets.AC_PASSWORD }} | |
run: | | |
# gon code sign | |
cat <<EOF >> gon.json | |
{ | |
"source" : [".workflow/exe"], | |
"bundle_id" : "com.kaichu.devtoys", | |
"sign" :{ | |
"application_identity" : "Developer ID Application: KAI CHU CHUNG" | |
} | |
} | |
EOF | |
gon -log-level=debug -log-json ./gon.json | |
# pack alfredworkflow | |
cd .workflow | |
plutil -replace version -string "${{ env.tag }}" info.plist | |
zip -r ../"DevToys_GALLERY-${{ env.tag }}.alfredworkflow" . | |
cd .. | |
# zip alfredworkflow as zip archive for notarize | |
zip -r "DevToys_GALLERY-${{ env.tag }}.alfredworkflow.zip" "DevToys_GALLERY-${{ env.tag }}.alfredworkflow" | |
# gon notarize | |
cat <<EOF >> notarize.json | |
{ | |
"notarize": [{ | |
"path": "${PWD}/DevToys_GALLERY-${{ env.tag }}.alfredworkflow.zip", | |
"bundle_id": "com.kaichu.devtoys", | |
"staple": false | |
}] | |
} | |
EOF | |
gon -log-level=debug -log-json ./notarize.json | |
echo "artifact=$(echo "DevToys_GALLERY-${{ env.tag }}.alfredworkflow")" >> $GITHUB_ENV | |
- uses: shogo82148/actions-upload-release-asset@v1 | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: "${{ env.artifact }}" |