From 2d82eb7844276527331d94bc511d378cb86216c7 Mon Sep 17 00:00:00 2001 From: Larvan2 <78135608+Larvan2@users.noreply.github.com> Date: Mon, 20 Mar 2023 08:22:44 +0000 Subject: [PATCH] fix build --- .github/workflows/build.yml | 457 ++++++++++++++++++++---------------- 1 file changed, 251 insertions(+), 206 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b2c140..ba4ded1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,7 @@ name: GitHub CI -on: +on: push: - branches: [ master ] + branches: [master] workflow_dispatch: pull_request: @@ -10,8 +10,234 @@ concurrency: cancel-in-progress: true jobs: - first_step: - name: Delete current assets + linux32_build: + name: Linux x86 Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Add commit id into version + if: ${{ !startsWith(github.ref, 'refs/tags/') }} + run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h + - name: Build + run: docker run --rm -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:x86-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh" + + - name: Package Release + run: tar czf subconverter_linux32.tar.gz subconverter + + - name: Upload + uses: actions/upload-artifact@v3 + with: + path: | + subconverter_*.tar.gz + + - name: Draft Release + uses: softprops/action-gh-release@v1 + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + with: + files: subconverter_linux32.tar.gz + draft: true + tag_name: Alpha + + linux64_build: + name: Linux x86_64 Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Add commit id into version + if: ${{ !startsWith(github.ref, 'refs/tags/') }} + run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h + - name: Build + run: docker run -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:amd64-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh" + + - name: Package Release + run: tar czf subconverter_linux64.tar.gz subconverter + + - name: Upload + uses: actions/upload-artifact@v3 + with: + path: | + subconverter_*.tar.gz + + - name: Draft Release + uses: softprops/action-gh-release@v1 + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + with: + files: subconverter_linux64.tar.gz + draft: true + tag_name: Alpha + + # armv7_build: + # name: Linux armv7 Build + # runs-on: [self-hosted, linux, ARM64] + # steps: + # - uses: actions/checkout@v3 + # - name: Add commit id into version + # if: ${{ !startsWith(github.ref, 'refs/tags/') }} + # run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h + # - name: Build + # run: docker run -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:armv7-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh" + # - name: Upload + # uses: actions/upload-artifact@v3 + # with: + # name: subconverter_armv7 + # path: subconverter/ + # - name: Package Release + # if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + # run: tar czf subconverter_armv7.tar.gz subconverter + # - name: Draft Release + # uses: softprops/action-gh-release@v1 + # if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + # with: + # files: subconverter_armv7.tar.gz + # draft: true + # tag_name: Alpha + + # aarch64_build: + # name: Linux aarch64 Build + # runs-on: [self-hosted, linux, ARM64] + # steps: + # - uses: actions/checkout@v3 + # - name: Add commit id into version + # if: ${{ !startsWith(github.ref, 'refs/tags/') }} + # run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h + # - name: Build + # run: docker run -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:aarch64-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh" + # - name: Upload + # uses: actions/upload-artifact@v3 + # with: + # name: subconverter_aarch64 + # path: subconverter/ + # - name: Package Release + # if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + # run: tar czf subconverter_aarch64.tar.gz subconverter + # - name: Draft Release + # uses: softprops/action-gh-release@v1 + # if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + # with: + # files: subconverter_aarch64.tar.gz + # draft: true + # tag_name: Alpha + + macos_build: + name: macOS Build + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - name: Add commit id into version + if: ${{ !startsWith(github.ref, 'refs/tags/') }} + run: SHA=$(git rev-parse --short HEAD) && sed -i -e 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h + - name: Build + run: bash scripts/build.macos.release.sh + + - name: Package Release + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + run: tar czf subconverter_darwin64.tar.gz subconverter + + - name: Upload + uses: actions/upload-artifact@v3 + with: + path: | + subconverter_*.tar.gz + + - name: Draft Release + uses: softprops/action-gh-release@v1 + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + with: + files: subconverter_darwin64.tar.gz + draft: true + tag_name: Alpha + + windows64_build: + name: Windows x86_64 Build + runs-on: windows-latest + defaults: + run: + shell: msys2 {0} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: "16" + - uses: msys2/setup-msys2@v2 + with: + update: true + install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-libevent mingw-w64-x86_64-pcre2 patch + msystem: MINGW64 + path-type: inherit + - name: Add commit id into version + if: ${{ !startsWith(github.ref, 'refs/tags/') }} + run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h + - name: Build + run: bash scripts/build.windows.release.sh + + - name: Package Release + run: 7z a subconverter_win64.7z subconverter/ + + - name: Upload + uses: actions/upload-artifact@v3 + with: + path: | + subconverter_*.7z + + - name: Draft Release + uses: softprops/action-gh-release@v1 + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + with: + files: subconverter_win64.7z + draft: true + tag_name: Alpha + + windows32_build: + name: Windows x86 Build + runs-on: windows-latest + defaults: + run: + shell: msys2 {0} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: "16" + - uses: msys2/setup-msys2@v2 + with: + update: true + install: base-devel git mingw-w64-i686-gcc mingw-w64-i686-cmake mingw-w64-i686-libevent mingw-w64-i686-pcre2 patch + msystem: MINGW32 + path-type: inherit + - name: Add commit id into version + if: ${{ !startsWith(github.ref, 'refs/tags/') }} + run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h + - name: Build + run: bash scripts/build.windows.release.sh + + - name: Package Release + run: 7z a subconverter_win32.7z subconverter/ + + - name: Upload + uses: actions/upload-artifact@v3 + with: + path: | + subconverter_*.7z + + - name: Draft Release + uses: softprops/action-gh-release@v1 + if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} + with: + files: subconverter_win32.7z + draft: true + tag_name: Alpha + + Upload-Release: + permissions: write-all + if: ${{ github.ref_type=='branch' }} + needs: + [ + linux64_build, + linux32_build, + macos_build, + windows64_build, + windows32_build, + ] runs-on: ubuntu-latest steps: - name: Delete current release assets @@ -21,208 +247,27 @@ jobs: tag: Alpha deleteOnlyFromDrafts: false - linux32_build: - name: Linux x86 Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Add commit id into version - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h - - name: Build - run: docker run --rm -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:x86-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh" - - name: Upload - uses: actions/upload-artifact@v3 - with: - name: subconverter_linux32 - path: subconverter/ - - name: Package Release - if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} - run: tar czf subconverter_linux32.tar.gz subconverter - - name: Draft Release - uses: softprops/action-gh-release@v1 - if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} - with: - files: subconverter_linux32.tar.gz - draft: true - tag_name: Alpha + - uses: actions/download-artifact@v3 + with: + name: artifact + path: bin/ - linux64_build: - name: Linux x86_64 Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Add commit id into version - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h - - name: Build - run: docker run -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:amd64-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh" - - name: Upload - uses: actions/upload-artifact@v3 - with: - name: subconverter_linux64 - path: subconverter/ - - name: Package Release - if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} - run: tar czf subconverter_linux64.tar.gz subconverter - - name: Draft Release - uses: softprops/action-gh-release@v1 - if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} - with: - files: subconverter_linux64.tar.gz - draft: true - tag_name: Alpha + - name: Display structure of downloaded files + run: ls -R + working-directory: bin - armv7_build: - name: Linux armv7 Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Add commit id into version - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h - - name: Build - run: docker run -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:armv7-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh" - - name: Upload - uses: actions/upload-artifact@v3 - with: - name: subconverter_armv7 - path: subconverter/ - - name: Package Release - if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} - run: tar czf subconverter_armv7.tar.gz subconverter - - name: Draft Release - uses: softprops/action-gh-release@v1 - if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} - with: - files: subconverter_armv7.tar.gz - draft: true - tag_name: Alpha + - name: Tag Repo + uses: richardsimko/update-tag@v1.0.6 + with: + tag_name: Alpha + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - aarch64_build: - name: Linux aarch64 Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Add commit id into version - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h - - name: Build - run: docker run -v $GITHUB_WORKSPACE:/root/workdir multiarch/alpine:aarch64-latest-stable /bin/sh -c "apk add bash git nodejs npm && cd /root/workdir && chmod +x scripts/build.alpine.release.sh && bash scripts/build.alpine.release.sh" - - name: Upload - uses: actions/upload-artifact@v3 - with: - name: subconverter_aarch64 - path: subconverter/ - - name: Package Release - if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} - run: tar czf subconverter_aarch64.tar.gz subconverter - - name: Draft Release - uses: softprops/action-gh-release@v1 - if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} - with: - files: subconverter_aarch64.tar.gz - draft: true - tag_name: Alpha - - macos_build: - name: macOS Build - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - name: Add commit id into version - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: SHA=$(git rev-parse --short HEAD) && sed -i -e 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h - - name: Build - run: bash scripts/build.macos.release.sh - - name: Upload - uses: actions/upload-artifact@v3 - with: - name: subconverter_darwin64 - path: subconverter/ - - name: Package Release - if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} - run: tar czf subconverter_darwin64.tar.gz subconverter - - name: Draft Release - uses: softprops/action-gh-release@v1 - if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} - with: - files: subconverter_darwin64.tar.gz - draft: true - tag_name: Alpha - - windows64_build: - name: Windows x86_64 Build - runs-on: windows-latest - defaults: - run: - shell: msys2 {0} - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '16' - - uses: msys2/setup-msys2@v2 - with: - update: true - install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-libevent mingw-w64-x86_64-pcre2 patch - msystem: MINGW64 - path-type: inherit - - name: Add commit id into version - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h - - name: Build - run: bash scripts/build.windows.release.sh - - name: Upload - uses: actions/upload-artifact@v3 - with: - name: subconverter_win64 - path: subconverter/ - - name: Package Release - if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} - run: 7z a subconverter_win64.7z subconverter/ - - name: Draft Release - uses: softprops/action-gh-release@v1 - if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} - with: - files: subconverter_win64.7z - draft: true - tag_name: Alpha - - windows32_build: - name: Windows x86 Build - runs-on: windows-latest - defaults: - run: - shell: msys2 {0} - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '16' - - uses: msys2/setup-msys2@v2 - with: - update: true - install: base-devel git mingw-w64-i686-gcc mingw-w64-i686-cmake mingw-w64-i686-libevent mingw-w64-i686-pcre2 patch - msystem: MINGW32 - path-type: inherit - - name: Add commit id into version - if: ${{ !startsWith(github.ref, 'refs/tags/') }} - run: SHA=$(git rev-parse --short HEAD) && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h - - name: Build - run: bash scripts/build.windows.release.sh - - name: Upload - uses: actions/upload-artifact@v3 - with: - name: subconverter_win32 - path: subconverter/ - - name: Package Release - if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} - run: 7z a subconverter_win32.7z subconverter/ - - name: Draft Release - uses: softprops/action-gh-release@v1 - if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} - with: - files: subconverter_win32.7z - draft: true - tag_name: Alpha + - name: Upload Release + uses: softprops/action-gh-release@v1 + if: ${{ success() }} + with: + tag: Alpha + tag_name: Alpha + files: bin/* + generate_release_notes: true