feat: 支持命令行获取或设置输入模式 #87
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: build installer.pkg | |
on: | |
workflow_dispatch: | |
inputs: | |
release: | |
description: 'release version' | |
required: true | |
default: 'v1.0.2' | |
pull_request: | |
types: [closed] | |
jobs: | |
create_release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # 创建 release 需要此权限 | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master' || github.event_name == 'workflow_dispatch' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Conventional Changelog Action | |
id: changelog | |
uses: TriPSs/conventional-changelog-action@v3 | |
with: | |
github-token: ${{ secrets.github_token }} | |
skip-commit: "true" | |
output-file: "false" | |
- name: Create Release | |
uses: actions/create-release@v1 | |
id: create_release | |
if: steps.changelog.outputs.skipped == 'false' | |
env: | |
GITHUB_TOKEN: ${{ secrets.github_token }} | |
with: | |
tag_name: ${{ steps.changelog.outputs.tag }} | |
release_name: ${{ steps.changelog.outputs.tag }} | |
body: ${{ steps.changelog.outputs.clean_changelog }} | |
- name: write update url to temp | |
env: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
run: | | |
mkdir tmp | |
echo "${upload_url}" > tmp/upload_url | |
- uses: lifepal/[email protected] | |
id: create_html | |
with: | |
text: ${{ steps.changelog.outputs.clean_changelog }} | |
- name: write changelog to temp | |
env: | |
changelog_html: ${{ steps.create_html.outputs.html }} | |
run: echo "$changelog_html" > tmp/changelog_html | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: tmp | |
path: ./tmp/ | |
retention-days: 2 | |
build_binary: | |
runs-on: macos-13 | |
needs: create_release | |
env: | |
USE_CODE_SIGN: ${{ !inputs.disable_sign && github.actor_id == github.repository_owner_id && 'enable' || 'disable' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: checkout tag | |
run: | | |
git checkout master | |
git pull | |
git status | |
version=$(git describe --tags `git rev-list --tags --max-count=1`) | |
echo $version | |
git checkout $version | |
- name: switch xcode version | |
run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app | |
- name: import application certificate | |
id: keychain | |
uses: apple-actions/import-codesign-certs@v2 | |
with: | |
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }} | |
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }} | |
- name: import installer certificate | |
uses: apple-actions/import-codesign-certs@v2 | |
with: | |
create-keychain: false | |
keychain-password: ${{ steps.keychain.outputs.keychain-password }} | |
p12-file-base64: ${{ secrets.CERTIFICATES_INSTALLER_P12 }} | |
p12-password: ${{ secrets.CERTIFICATES_INSTALLER_P12_PASSWORD }} | |
- name: prepare sqlcipher | |
run: ./scripts/0_prepare_sqlcipher.sh | |
- name: build Fire.app | |
run: ./scripts/a_build_app.sh | |
- name: build FireInstaller.pkg | |
run: ./scripts/b_build_installer.sh | |
- name: notarize FireInstaller.pkg | |
env: | |
apple_id: ${{ secrets.APPLE_ID }} | |
apple_id_password: ${{ secrets.APPLE_ID_PASSWORD }} | |
team_id: ${{ secrets.TEAM_ID }} | |
run: ./scripts/c_notarize_installer.sh | |
- uses: actions/download-artifact@v4 | |
with: | |
name: tmp | |
path: ./tmp | |
- name: load changelog to env | |
id: load_changelog | |
run: | | |
changelog=`cat tmp/changelog_html | xargs` | |
echo "changelog_html=${changelog}" >> $GITHUB_OUTPUT | |
- name: generate appcast.xml | |
env: | |
sparkle_key: ${{ secrets.sparkle_key }} | |
update_notes: ${{ steps.load_changelog.outputs.changelog_html }} | |
run: ./scripts/d_build_appcast.sh | |
- name: gather artifact | |
run: cp ./Fire/Info.plist ./dist/ | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: ./dist/ | |
retention-days: 7 | |
upload_publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # 创建 release 需要此权限 | |
needs: build_binary | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: ./dist | |
- uses: actions/download-artifact@v4 | |
with: | |
name: tmp | |
path: ./tmp | |
- name: load update url | |
id: get_upload_url | |
run: | | |
value=`cat tmp/upload_url` | |
echo "upload_url=${value}" >> $GITHUB_OUTPUT | |
- name: Upload Release Asset(installer.pkg) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_upload_url.outputs.upload_url }} | |
asset_path: ./dist/FireInstaller.pkg | |
asset_name: FireInstaller.pkg | |
asset_content_type: application/octet-stream | |
- name: Upload Release Asset(installer.zip) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_upload_url.outputs.upload_url }} | |
asset_path: ./dist/FireInstaller.zip | |
asset_name: FireInstaller.zip | |
asset_content_type: application/zip | |
- name: Upload Release Asset(Fire.zip) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_upload_url.outputs.upload_url }} | |
asset_path: ./dist/Fire.zip | |
asset_name: Fire.zip | |
asset_content_type: application/zip | |
- name: commit appcast.xml to gh-pages branch | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git checkout . | |
git fetch | |
git checkout gh-pages | |
mv dist/appcast.xml ./appcast.xml | |
git add appcast.xml | |
git commit -m "feat: 更新appcast.xml" | |
git push origin gh-pages |