chore: docker build #93
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: GitHub CI | |
on: | |
push: | |
branches: [master] | |
workflow_dispatch: | |
pull_request: | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
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: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- 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: Package Release | |
run: tar czf subconverter_armv7.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_armv7.tar.gz | |
draft: true | |
tag_name: Alpha | |
aarch64_build: | |
name: Linux aarch64 Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- 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: Package Release | |
run: tar czf subconverter_aarch64.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_aarch64.tar.gz | |
draft: true | |
tag_name: Alpha | |
armhf_build: | |
name: Linux armhf Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- 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:armhf-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_armhf.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_armhf.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 | |
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, | |
armv7_build, | |
armhf_build, | |
aarch64_build, | |
macos_build, | |
windows64_build, | |
windows32_build, | |
] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Delete current release assets | |
uses: andreaswilli/delete-release-assets-action@v2.0.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tag: Alpha | |
deleteOnlyFromDrafts: false | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: bin/ | |
- name: Display structure of downloaded files | |
run: ls -R | |
working-directory: bin | |
- name: Tag Repo | |
uses: richardsimko/update-tag@v1.0.6 | |
with: | |
tag_name: Alpha | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Release | |
uses: softprops/action-gh-release@v1 | |
if: ${{ success() }} | |
with: | |
tag: Alpha | |
tag_name: Alpha | |
files: bin/* | |
generate_release_notes: true |