fix path error #37
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: flutter build and release | |
on: | |
push: | |
tags: | |
- "*" | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
env: | |
RELEASE_NOTES_PATH: /tmp/release_notes | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build release notes | |
run: | | |
touch ${{ env.RELEASE_NOTES_PATH }} | |
echo ${{ github.ref_name }} | |
cat CHANGELOG.md | sed -e '/./{H;$!d;}' -e "x;/##\ Version\ ${{ github.ref_name }}/"'!d;' >> ${{ env.RELEASE_NOTES_PATH }} | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} # github.ref | |
release_name: v${{ github.ref_name }} # github.ref | |
body_path: ${{ env.RELEASE_NOTES_PATH }} | |
mac: | |
needs: create-release | |
permissions: | |
contents: write | |
pull-requests: write | |
runs-on: macos-latest | |
env: | |
MACOS_APP_RELEASE_PATH: flutter_app/build/macos/Build/Products/Release | |
MACOS_APP_NAME: thu_downloader | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
cache: true | |
- working-directory: flutter_app | |
run: flutter build macos --release | |
- name: Codesign executable | |
env: | |
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} | |
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }} | |
MACOS_PASSWD: ${{ secrets.MACOS_PASSWD }} | |
MACOS_DENTITY: ${{ secrets.MACOS_DENTITY }} | |
run: | | |
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12 | |
security create-keychain -p $MACOS_PASSWD build.keychain | |
security default-keychain -s build.keychain | |
security unlock-keychain -p $MACOS_PASSWD build.keychain | |
security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign | |
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_PASSWD build.keychain | |
codesign --deep --force --verbose -s $MACOS_DENTITY ${{ env.MACOS_APP_RELEASE_PATH }}/thu_downloader.app | |
- name: Create a dmg | |
working-directory: ${{ env.MACOS_APP_RELEASE_PATH }} | |
run: | | |
echo "Install create-dmg" | |
brew install create-dmg | |
create-dmg \ | |
--volname "$MACOS_APP_NAME" \ | |
--window-pos 200 120 \ | |
--window-size 800 529 \ | |
--icon-size 130 \ | |
--text-size 14 \ | |
--icon "$MACOS_APP_NAME.app" 260 250 \ | |
--hide-extension "$MACOS_APP_NAME.app" \ | |
--app-drop-link 540 250 \ | |
--hdiutil-quiet \ | |
"$MACOS_APP_NAME.dmg" \ | |
"$MACOS_APP_NAME.app" | |
- name: Upload Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url }} | |
asset_path: ${{ env.MACOS_APP_RELEASE_PATH }}/${{ env.MACOS_APP_NAME }}.dmg | |
asset_name: ${{ env.MACOS_APP_NAME }}-${{ github.ref_name }}.dmg | |
asset_content_type: application/octet-stream | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-mac | |
path: ${{ env.MACOS_APP_RELEASE_PATH }}/thu_downloader.dmg | |
win: | |
needs: create-release | |
permissions: | |
contents: write | |
pull-requests: write | |
runs-on: windows-latest | |
env: | |
WINDOWS_APP_RELEASE_PATH: flutter_app\build\windows\x64\runner\Release | |
WINDOWS_ZIP_NAME: thu_downloader.zip | |
WINDOWS_INSTALLER_NAME: thu_downloader-v${{ github.ref_name }}-windows-x86_64-installer | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
id: flutter-action-win | |
with: | |
channel: stable | |
cache: true | |
- working-directory: flutter_app | |
run: flutter build windows --release | |
- name: Copy installer config & icon file | |
working-directory: flutter_app | |
run: | | |
cp scripts/windows_installer/* ../${{ env.WINDOWS_APP_RELEASE_PATH }} | |
- name: Build installer executable | |
working-directory: ${{ env.WINDOWS_APP_RELEASE_PATH }} | |
run: | | |
iscc /F${{ env.WINDOWS_INSTALLER_NAME }} inno_setup_config.iss /DAppVersion=0.0.1 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-win | |
path: ${{ env.WINDOWS_APP_RELEASE_PATH }}\Output\${{ env.WINDOWS_INSTALLER_NAME }}.exe | |
- name: Upload Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url }} | |
asset_path: ${{ env.WINDOWS_APP_RELEASE_PATH }}\Output\${{ env.WINDOWS_INSTALLER_NAME }}.exe | |
asset_name: ${{ env.WINDOWS_INSTALLER_NAME }}.exe | |
asset_content_type: application/octet-stream | |
linux: | |
needs: create-release | |
permissions: | |
contents: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
env: | |
LINUX_APP_RELEASE_PATH: flutter_app/build/linux/x64/release/bundle | |
LINUX_APP_NAME: thu_downloader-v${{ github.ref_name }}_linux_archive | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
id: flutter-action-linux | |
with: | |
channel: stable | |
cache: true | |
- run: | | |
sudo apt-get update -y | |
sudo apt-get install -y ninja-build libgtk-3-dev | |
- working-directory: flutter_app | |
run: flutter build linux --release | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-linux | |
path: ${{ env.LINUX_APP_RELEASE_PATH }} | |
# zip release path | |
- name: zip Asset | |
uses: vimtor/action-zip@v1 | |
with: | |
files: ${{ env.LINUX_APP_RELEASE_PATH }} | |
dest: ${{ env.LINUX_APP_RELEASE_PATH }}/${{ env.LINUX_APP_NAME }}.zip | |
- name: Upload Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url }} | |
asset_path: ${{ env.LINUX_APP_RELEASE_PATH }}/${{ env.LINUX_APP_NAME }}.zip | |
asset_name: ${{ env.LINUX_APP_NAME }} | |
asset_content_type: application/octet-stream |