diff --git a/.github/workflows/auto_build.yml b/.github/workflows/auto_build.yml index 228c545..32d3863 100644 --- a/.github/workflows/auto_build.yml +++ b/.github/workflows/auto_build.yml @@ -88,330 +88,11 @@ jobs: } (async () => { await main(); })(); - - - name: 'Checkout and push specified tag version of scratch' + # https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow + - name: Triggering workflow of build.yml if: ${{ steps.check_tag_updated.outputs.tag_updated }} - run: | - git config --global pull.rebase false - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - cd scratch-gui - git status - git remote -v - git fetch --all --tags - git checkout tags/v${{ github.event.inputs.tag_version }} - git status - cd .. - git add scratch-gui - git commit -m "update scratch-gui to v${{ github.event.inputs.tag_version }}" - # update version in README.md using sed - sed -i "s/[0-9]\+\.[0-9]\+\.[0-9]\+/${{ github.event.inputs.tag_version }}/g" README.md - git add README.md - git commit -m "update README.md" - git tag ${{ github.event.inputs.tag_version }} - git push - git push --tag - - name: Use Node.js 18.x - if: ${{ steps.check_tag_updated.outputs.tag_updated }} - uses: actions/setup-node@v2 - with: - node-version: 18.x - cache: 'npm' - - name: 'Building scratch-gui' - if: ${{ steps.check_tag_updated.outputs.tag_updated }} - run: | - npm install - npm run build - working-directory: scratch-gui - - name: Deploy 🚀 - if: ${{ steps.check_tag_updated.outputs.tag_updated }} - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./scratch-gui/build - - name: Prepare build files achive - if: ${{ steps.check_tag_updated.outputs.tag_updated }} - run: | - 7z a -tzip ${{env.APP_NAME}}-${{ github.event.inputs.tag_version }}.zip -r ./scratch-gui/build/* - - uses: actions/upload-artifact@v2 - if: ${{ steps.check_tag_updated.outputs.tag_updated }} - with: - name: scratch-dist - path: ${{env.APP_NAME}}-${{ github.event.inputs.tag_version }}.zip - - name: 'Publish build files achive to release' - if: ${{ steps.check_tag_updated.outputs.tag_updated }} - uses: xresloader/upload-to-github-release@v1 env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - with: - tag_name: ${{ github.event.inputs.tag_version }} - file: ${{env.APP_NAME}}-${{ github.event.inputs.tag_version }}.zip - tags: true - draft: false - overwrite: true - - build_native_executable: - name: 'Build native executable' - needs: [build_static_files] - if: ${{ needs.build_static_files.outputs.tag_updated }} - strategy: - fail-fast: false - matrix: - os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] - include: - - os: 'ubuntu-latest' - label: 'linux' - executable_extension: '' - - os: 'macos-latest' - label: 'macos' - executable_extension: '' - - os: 'windows-latest' - label: 'windows' - executable_extension: '.exe' - runs-on: ${{matrix.os}} - steps: - - name: 'Checkout' - uses: actions/checkout@v2 - with: - submodules: true - - uses: actions/download-artifact@v2 - with: - name: scratch-dist - - name: Extract scratch-dist - run: | - rm -rf dist - unzip ${{env.APP_NAME}}-${{ github.event.inputs.tag_version }}.zip -d dist - - name: Display structure of downloaded files - run: ls -l . dist - - name: Use Node.js 18.x - uses: actions/setup-node@v2 - with: - node-version: 18.x - cache: 'yarn' - - name: check toolchain version - run: | - node --version - npm --version - yarn --version - rustc --version - cargo --version - - - name: 'Setup for linux' - if: matrix.os == 'ubuntu-latest' - run: |- - sudo ls -lR /etc/apt/ - echo ------------- - # sudo sed 's/mirror+file:\/etc\/apt\/apt-mirrors.txt/[arch-=amd64,i386] http:\/\/ports.ubuntu.com\/ubuntu-ports\//g' /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/ports.list - # echo ------------- - # sudo sed -i 's/mirror+file:\/etc\/apt\/apt-mirrors.txt/[arch=amd64,i386] http:\/\/archive.ubuntu.com\/ubuntu\//g' /etc/apt/sources.list - cat > /tmp/sources.list << EOF - deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy main multiverse universe restricted - deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-security main multiverse universe restricted - deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-updates main multiverse universe restricted - deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-backports main multiverse universe restricted - - deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports jammy main multiverse universe restricted - deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports jammy-security main multiverse universe restricted - deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports jammy-updates main multiverse universe restricted - deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports jammy-backports main multiverse universe restricted - EOF - sudo mv /etc/apt/sources.list /etc/apt/sources.list.default - sudo mv /tmp/sources.list /etc/apt/sources.list - - echo ------------- - echo /etc/apt/sources.list && cat /etc/apt/sources.list - echo ------------- - echo /etc/apt/apt-mirrors.txt && cat /etc/apt/apt-mirrors.txt - echo ------------- - echo /etc/apt/sources.list.d/ports.list && cat /etc/apt/sources.list.d/ports.list || true - echo ------------- - - sudo dpkg --add-architecture i386 - sudo dpkg --add-architecture arm64 - sudo dpkg --add-architecture armhf - sudo apt update - - sudo apt install -y \ - gcc-multilib \ - g++-multilib - - echo ------------- - echo install dependences ... - sudo apt install -y \ - libwebkit2gtk-4.0-dev \ - libssl-dev \ - libgtk-3-dev \ - librsvg2-dev \ - libayatana-appindicator3-dev - - echo ------------- - echo install 32-bit dependences ... - # libayatana-appindicator3-dev:i386 is missing, see https://packages.ubuntu.com/focal/libayatana-appindicator3-dev - sudo apt install -y \ - libwebkit2gtk-4.0-dev:i386 \ - libssl-dev:i386 \ - libgtk-3-dev:i386 \ - librsvg2-dev:i386 - - echo ------------- - echo install arm64 dependences ... - sudo apt install -y \ - gcc-aarch64-linux-gnu \ - g++-aarch64-linux-gnu \ - libc6-dev-arm64-cross \ - patchelf:arm64 \ - libwebkit2gtk-4.0-dev:arm64 \ - libssl-dev:arm64 \ - libgtk-3-dev:arm64 \ - librsvg2-dev:arm64 \ - libayatana-appindicator3-dev:arm64 - - echo ------------- - echo install armhf dependences ... - sudo apt install -y \ - gcc-arm-linux-gnueabihf \ - g++-arm-linux-gnueabihf \ - libc6-dev-armhf-cross \ - patchelf:armhf \ - libwebkit2gtk-4.0-dev:armhf \ - libssl-dev:armhf \ - libgtk-3-dev:armhf \ - librsvg2-dev:armhf \ - libayatana-appindicator3-dev:armhf - echo 'ok' - - name: 'Setup for macos' - if: matrix.os == 'macos-latest' - run: | - echo 'ok' - - name: 'Setup for windows' - if: matrix.os == 'windows-latest' - run: | - # choco install visualstudio2019-workload-vctools - # https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#visual-studio-enterprise-2019 - echo 'ok' - - - name: Build Native binarys on ubuntu - if: matrix.os == 'ubuntu-latest' - run: | - echo "build native binarys..." - rustup target add x86_64-unknown-linux-gnu - rustup target add i686-unknown-linux-gnu - rustup target add aarch64-unknown-linux-gnu - rustup target add armv7-unknown-linux-gnueabihf - yarn - yarn tauri info - yarn tauri build -t x86_64-unknown-linux-gnu -v -c "{\"package\":{\"version\":\"${{ github.event.inputs.tag_version }}\"}}" - export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig/:$PKG_CONFIG_PATH - export PKG_CONFIG_SYSROOT_DIR=/ - yarn tauri build -t i686-unknown-linux-gnu -v -c "{\"package\":{\"version\":\"${{ github.event.inputs.tag_version }}\"}}" - # export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc - # export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc - # export CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++ - # export PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig - # export PKG_CONFIG_ALLOW_CROSS=1 - export PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu/ - yarn tauri build -t aarch64-unknown-linux-gnu -v -c "{\"package\":{\"version\":\"${{ github.event.inputs.tag_version }}\"}}" -b deb || echo something not works! - - # export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc - # export CC_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc - # export CXX_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++ - # export PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig - # export PKG_CONFIG_ALLOW_CROSS=1 - export PKG_CONFIG_SYSROOT_DIR=/usr/arm-linux-gnueabihf/ - yarn tauri build -t armv7-unknown-linux-gnueabihf -v -c "{\"package\":{\"version\":\"${{ github.event.inputs.tag_version }}\"}}" -b deb || echo something not works! - echo "build native binarys finished" - - name: Build Native binarys on macos - if: matrix.os == 'macos-latest' + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - echo "build native binarys..." - rustup target add x86_64-apple-darwin - rustup target add aarch64-apple-darwin - yarn - yarn tauri info - yarn tauri build -t x86_64-apple-darwin -c "{\"package\":{\"version\":\"${{ github.event.inputs.tag_version }}\"}}" - yarn tauri build -t aarch64-apple-darwin -c "{\"package\":{\"version\":\"${{ github.event.inputs.tag_version }}\"}}" - yarn tauri build -t universal-apple-darwin -c "{\"package\":{\"version\":\"${{ github.event.inputs.tag_version }}\"}}" || echo something not works! - echo "build native binarys finished" - - name: Build Native binarys on windows - if: matrix.os == 'windows-latest' - run: | - echo "build native binarys..." - rustup target add x86_64-pc-windows-msvc - rustup target add i686-pc-windows-msvc - rustup target add aarch64-pc-windows-msvc - yarn - yarn tauri info - yarn tauri build -t x86_64-pc-windows-msvc -c "{\"package\":{\"version\":\"${{ github.event.inputs.tag_version }}\"}}" - yarn tauri build -t i686-pc-windows-msvc -c "{\"package\":{\"version\":\"${{ github.event.inputs.tag_version }}\"}}" - yarn tauri build -t aarch64-pc-windows-msvc -c "{\"package\":{\"version\":\"${{ github.event.inputs.tag_version }}\"}}" -b nsis || echo something not works! - echo "build native binarys finished" - - name: Display structure of build files - continue-on-error: true - run: | - ls -lR src-tauri/target/ - - - name: Prepare release files on ${{matrix.label}} - continue-on-error: true - if: matrix.os == 'ubuntu-latest' - run: | - # for 64-bit binary - mv src-tauri/target/x86_64-unknown-linux-gnu/release/${{env.APP_NAME}}${{matrix.executable_extension}} ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_amd64${{matrix.executable_extension}} - mv src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/${{env.APP_NAME}}_${{ github.event.inputs.tag_version }}_amd64.AppImage ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_amd64.AppImage - mv src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/deb/${{env.APP_NAME}}_${{ github.event.inputs.tag_version }}_amd64.deb ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_amd64.deb - # for 32-bit binary - mv src-tauri/target/i686-unknown-linux-gnu/release/${{env.APP_NAME}}${{matrix.executable_extension}} ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_i386${{matrix.executable_extension}} - mv src-tauri/target/i686-unknown-linux-gnu/release/bundle/appimage/${{env.APP_NAME}}_${{ github.event.inputs.tag_version }}_i386.AppImage ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_i386.AppImage - mv src-tauri/target/i686-unknown-linux-gnu/release/bundle/deb/${{env.APP_NAME}}_${{ github.event.inputs.tag_version }}_i386.deb ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_i386.deb - - # for arm64 binary - mv src-tauri/target/aarch64-unknown-linux-gnu/release/${{env.APP_NAME}}${{matrix.executable_extension}} ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_arm64${{matrix.executable_extension}} || true - # mv src-tauri/target/aarch64-unknown-linux-gnu/release/bundle/appimage/${{env.APP_NAME}}_${{ github.event.inputs.tag_version }}_arm64.AppImage ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_arm64.AppImage || true - mv src-tauri/target/aarch64-unknown-linux-gnu/release/bundle/deb/${{env.APP_NAME}}_${{ github.event.inputs.tag_version }}_arm64.deb ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_arm64.deb || true - # for armhf binary - mv src-tauri/target/armv7-unknown-linux-gnueabihf/release/${{env.APP_NAME}}${{matrix.executable_extension}} ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_armhf${{matrix.executable_extension}} || true - # mv src-tauri/target/armv7-unknown-linux-gnueabihf/release/bundle/appimage/${{env.APP_NAME}}_${{ github.event.inputs.tag_version }}_armhf.AppImage ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_armhf.AppImage || true - mv src-tauri/target/armv7-unknown-linux-gnueabihf/release/bundle/deb/${{env.APP_NAME}}_${{ github.event.inputs.tag_version }}_armhf.deb ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_armhf.deb || true - - name: Prepare release files on ${{matrix.label}} - continue-on-error: true - if: matrix.os == 'macos-latest' - run: | - mv src-tauri/target/x86_64-apple-darwin/release/${{env.APP_NAME}}${{matrix.executable_extension}} ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_x64${{matrix.executable_extension}} - mv src-tauri/target/x86_64-apple-darwin/release/bundle/dmg/${{env.APP_NAME}}_${{ github.event.inputs.tag_version }}_x64.dmg ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_x64.dmg - 7z a -tzip ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_x64.app.zip ./src-tauri/target/x86_64-apple-darwin/release/bundle/macos/${{env.APP_NAME}}.app - - mv src-tauri/target/aarch64-apple-darwin/release/${{env.APP_NAME}}${{matrix.executable_extension}} ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_aarch64${{matrix.executable_extension}} - mv src-tauri/target/aarch64-apple-darwin/release/bundle/dmg/${{env.APP_NAME}}_${{ github.event.inputs.tag_version }}_aarch64.dmg ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_aarch64.dmg - 7z a -tzip ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_aarch64.app.zip ./src-tauri/target/aarch64-apple-darwin/release/bundle/macos/${{env.APP_NAME}}.app - - mv src-tauri/target/universal-apple-darwin/release/${{env.APP_NAME}}${{matrix.executable_extension}} ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_universal${{matrix.executable_extension}} - mv src-tauri/target/universal-apple-darwin/release/bundle/dmg/${{env.APP_NAME}}_${{ github.event.inputs.tag_version }}_universal.dmg ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_universal.dmg - 7z a -tzip ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_universal.app.zip ./src-tauri/target/universal-apple-darwin/release/bundle/macos/${{env.APP_NAME}}.app - - name: Prepare release files on ${{matrix.label}} - continue-on-error: true - if: matrix.os == 'windows-latest' - run: | - mv src-tauri/target/x86_64-pc-windows-msvc/release/${{env.APP_NAME}}${{matrix.executable_extension}} ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_x64${{matrix.executable_extension}} - mv src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi/${{env.APP_NAME}}_${{ github.event.inputs.tag_version }}_x64_en-US.msi ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_x64.msi - mv src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/${{env.APP_NAME}}_${{ github.event.inputs.tag_version }}_x64-setup.exe ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_x64-setup.exe - mv src-tauri/target/i686-pc-windows-msvc/release/${{env.APP_NAME}}${{matrix.executable_extension}} ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_x86${{matrix.executable_extension}} - mv src-tauri/target/i686-pc-windows-msvc/release/bundle/msi/${{env.APP_NAME}}_${{ github.event.inputs.tag_version }}_x86_en-US.msi ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_x86.msi - mv src-tauri/target/i686-pc-windows-msvc/release/bundle/nsis/${{env.APP_NAME}}_${{ github.event.inputs.tag_version }}_x86-setup.exe ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_x86-setup.exe - mv src-tauri/target/aarch64-pc-windows-msvc/release/${{env.APP_NAME}}${{matrix.executable_extension}} ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_arm64${{matrix.executable_extension}} || true - # mv src-tauri/target/aarch64-pc-windows-msvc/release/bundle/msi/${{env.APP_NAME}}_${{ github.event.inputs.tag_version }}_arm64_en-US.msi ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_arm64.msi || true - mv src-tauri/target/aarch64-pc-windows-msvc/release/bundle/nsis/${{env.APP_NAME}}_${{ github.event.inputs.tag_version }}_arm64-setup.exe ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}_arm64-setup.exe || true - - - name: Display structure of build files - run: | - ls -l . - - - name: 'Publish binary to release' - continue-on-error: true - uses: xresloader/upload-to-github-release@v1 - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - with: - tag_name: ${{ github.event.inputs.tag_version }} - file: ${{env.APP_NAME}}-${{matrix.label}}-${{ github.event.inputs.tag_version }}* - tags: true - draft: false - overwrite: true \ No newline at end of file + # gh workflow run build.yml -f tag_version=3.2.27 --repo liudonghua123/scratch-app + gh workflow run build.yml -f tag_version=${{ steps.check_tag_updated.outputs.latest_upstream_tag_name }} \ No newline at end of file