| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420 |
- name: dist
- on:
- push:
- branches:
- - master
- tags:
- - '*'
- permissions:
- contents: write
- concurrency:
- group: crown-package-${{ github.ref }}
- cancel-in-progress: false
- jobs:
- detect:
- runs-on: ubuntu-22.04
- outputs:
- is_tag: ${{ steps.detect.outputs.is_tag }}
- version: ${{ steps.detect.outputs.version }}
- branch: ${{ steps.detect.outputs.branch }}
- steps:
- - name: prepare
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- ref: ${{ github.ref }}
- - name: detect
- id: detect
- run: |
- set -euo pipefail
- if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
- echo "is_tag=true" >> $GITHUB_OUTPUT
- echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- echo "branch=" >> $GITHUB_OUTPUT
- else
- echo "is_tag=false" >> $GITHUB_OUTPUT
- if [ -n "${GITHUB_HEAD_REF:-}" ]; then
- BRANCH="${GITHUB_HEAD_REF}"
- else
- if [[ "${GITHUB_REF}" == refs/heads/* ]]; then
- BRANCH="${GITHUB_REF#refs/heads/}"
- else
- BRANCH="$(git rev-parse --abbrev-ref HEAD 2>/dev/null || true)"
- if [ -z "${BRANCH:-}" ] || [ "${BRANCH}" = "HEAD" ]; then
- BRANCH="$(git name-rev --name-only HEAD 2>/dev/null || true)"
- fi
- BRANCH="${BRANCH#remotes/origin/}"
- fi
- fi
- echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
- if [[ "${BRANCH}" == "master" ]]; then
- echo "version=master" >> $GITHUB_OUTPUT
- else
- echo "version=${BRANCH}" >> $GITHUB_OUTPUT
- fi
- fi
- android-arm:
- needs: detect
- runs-on: ubuntu-22.04
- env:
- IS_TAG: ${{ needs.detect.outputs.is_tag }}
- VERSION: ${{ needs.detect.outputs.version }}
- BRANCH: ${{ needs.detect.outputs.branch }}
- steps:
- - name: prepare
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- ref: ${{ github.ref }}
- - name: detect
- run: |
- set -euo pipefail
- echo "IS_TAG=${IS_TAG}" >> $GITHUB_ENV
- echo "VERSION=${VERSION}" >> $GITHUB_ENV
- echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
- - name: install-deps
- shell: bash
- run: |
- set -euo pipefail
- sudo apt-get update
- sudo apt-get install libc6-dev-i386
- ANDROID_SDK_ROOT=/usr/local/lib/android/sdk
- SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager
- echo "y" | $SDKMANAGER "ndk;23.2.8568313"
- - name: package
- shell: bash
- run: |
- set -euo pipefail
- export ANDROID_NDK_ROOT=$ANDROID_HOME/ndk/23.2.8568313
- export ANDROID_NDK_ABI=23
- if [ "$IS_TAG" = "true" ]; then
- ./scripts/dist/package.sh android arm --noconfirm
- else
- ./scripts/dist/package.sh android arm --branch "${BRANCH}" --noconfirm
- fi
- - name: upload-dist
- uses: actions/upload-artifact@v4
- with:
- name: dist-android-arm
- path: dist-android-arm.tar.gz
- retention-days: 1
- android-arm64:
- needs: detect
- runs-on: ubuntu-22.04
- env:
- IS_TAG: ${{ needs.detect.outputs.is_tag }}
- VERSION: ${{ needs.detect.outputs.version }}
- BRANCH: ${{ needs.detect.outputs.branch }}
- steps:
- - name: prepare
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- ref: ${{ github.ref }}
- - name: detect
- run: |
- set -euo pipefail
- echo "IS_TAG=${IS_TAG}" >> $GITHUB_ENV
- echo "VERSION=${VERSION}" >> $GITHUB_ENV
- echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
- - name: install-deps
- shell: bash
- run: |
- set -euo pipefail
- sudo apt-get update
- sudo apt-get install libc6-dev-i386
- ANDROID_SDK_ROOT=/usr/local/lib/android/sdk
- SDKMANAGER=${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager
- echo "y" | $SDKMANAGER "ndk;23.2.8568313"
- - name: package
- shell: bash
- run: |
- set -euo pipefail
- export ANDROID_NDK_ROOT=$ANDROID_HOME/ndk/23.2.8568313
- export ANDROID_NDK_ABI=23
- if [ "$IS_TAG" = "true" ]; then
- ./scripts/dist/package.sh android arm64 --noconfirm
- else
- ./scripts/dist/package.sh android arm64 --branch "${BRANCH}" --noconfirm
- fi
- - name: upload-dist
- uses: actions/upload-artifact@v4
- with:
- name: dist-android-arm64
- path: dist-android-arm64.tar.gz
- retention-days: 1
- html5-wasm:
- needs: detect
- runs-on: ubuntu-22.04
- env:
- IS_TAG: ${{ needs.detect.outputs.is_tag }}
- VERSION: ${{ needs.detect.outputs.version }}
- BRANCH: ${{ needs.detect.outputs.branch }}
- steps:
- - name: prepare
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- ref: ${{ github.ref }}
- - name: detect
- run: |
- set -euo pipefail
- echo "IS_TAG=${IS_TAG}" >> $GITHUB_ENV
- echo "VERSION=${VERSION}" >> $GITHUB_ENV
- echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
- - name: install-deps
- shell: bash
- run: |
- set -euo pipefail
- git clone https://github.com/emscripten-core/emsdk.git "${GITHUB_WORKSPACE}/emsdk"
- pushd "${GITHUB_WORKSPACE}/emsdk"
- ./emsdk install latest
- ./emsdk activate latest
- popd
- - name: package
- shell: bash
- run: |
- set -euo pipefail
- export EMSCRIPTEN=$GITHUB_WORKSPACE/emsdk/upstream/emscripten
- if [ "$IS_TAG" = "true" ]; then
- ./scripts/dist/package.sh html5 wasm --noconfirm
- else
- ./scripts/dist/package.sh html5 wasm --branch "${BRANCH}" --noconfirm
- fi
- - name: upload-dist
- uses: actions/upload-artifact@v4
- with:
- name: dist-html5-wasm
- path: dist-html5-wasm.tar.gz
- retention-days: 1
- linux-x64:
- needs: detect
- runs-on: ubuntu-22.04
- env:
- IS_TAG: ${{ needs.detect.outputs.is_tag }}
- VERSION: ${{ needs.detect.outputs.version }}
- BRANCH: ${{ needs.detect.outputs.branch }}
- steps:
- - name: prepare
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- ref: ${{ github.ref }}
- - name: detect
- run: |
- set -euo pipefail
- echo "IS_TAG=${IS_TAG}" >> $GITHUB_ENV
- echo "VERSION=${VERSION}" >> $GITHUB_ENV
- echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
- - name: install-deps
- shell: bash
- run: |
- set -euo pipefail
- sudo apt-get update
- sudo apt-get install -y mesa-common-dev libgl1-mesa-dev libpulse-dev libxrandr-dev libc6-dev-i386
- sudo apt-get install -y libgtk-3-dev
- sudo add-apt-repository ppa:vala-team -y
- sudo apt-get update
- sudo apt-get install -y valac libgee-0.8-dev
- sudo apt-get install -y libxml2-utils
- - name: package
- shell: bash
- run: |
- set -euo pipefail
- if [ "$IS_TAG" = "true" ]; then
- ./scripts/dist/package.sh linux x64 --noconfirm
- else
- ./scripts/dist/package.sh linux x64 --branch "${BRANCH}" --noconfirm
- fi
- - name: upload-dist
- uses: actions/upload-artifact@v4
- with:
- name: dist-linux-x64
- path: dist-linux-x64.tar.gz
- retention-days: 1
- windows-x64:
- needs: detect
- runs-on: windows-latest
- env:
- IS_TAG: ${{ needs.detect.outputs.is_tag }}
- VERSION: ${{ needs.detect.outputs.version }}
- BRANCH: ${{ needs.detect.outputs.branch }}
- steps:
- - name: setup-msys2
- uses: msys2/setup-msys2@v2
- with:
- msystem: MINGW64
- update: false
- - name: prepare
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- ref: ${{ github.ref }}
- - name: detect
- shell: msys2 {0}
- run: |
- set -euo pipefail
- echo "IS_TAG=${IS_TAG}" >> $GITHUB_ENV
- echo "VERSION=${VERSION}" >> $GITHUB_ENV
- echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
- - name: install-deps
- shell: msys2 {0}
- run: |
- set -euo pipefail
- pacman --noconfirm -S make mingw-w64-x86_64-gcc mingw-w64-x86_64-pkgconf mingw-w64-x86_64-gtk3 mingw-w64-x86_64-vala mingw-w64-x86_64-libgee git
- - name: package
- shell: msys2 {0}
- run: |
- set -euo pipefail
- if [ "$IS_TAG" = "true" ]; then
- ./scripts/dist/package.sh windows x64 --noconfirm
- else
- ./scripts/dist/package.sh windows x64 --branch "${BRANCH}" --noconfirm
- fi
- - name: upload-dist
- uses: actions/upload-artifact@v4
- with:
- name: dist-windows-x64
- path: dist-windows-x64.tar.gz
- retention-days: 1
- windows-x32:
- needs: detect
- runs-on: windows-latest
- env:
- IS_TAG: ${{ needs.detect.outputs.is_tag }}
- VERSION: ${{ needs.detect.outputs.version }}
- BRANCH: ${{ needs.detect.outputs.branch }}
- steps:
- - name: setup-msys2
- uses: msys2/setup-msys2@v2
- with:
- msystem: MINGW32
- update: false
- - name: prepare
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- ref: ${{ github.ref }}
- - name: detect
- shell: msys2 {0}
- run: |
- set -euo pipefail
- echo "IS_TAG=${IS_TAG}" >> $GITHUB_ENV
- echo "VERSION=${VERSION}" >> $GITHUB_ENV
- echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
- - name: install-deps
- shell: msys2 {0}
- run: |
- set -euo pipefail
- pacman --noconfirm -S make mingw-w64-i686-gcc mingw-w64-i686-pkgconf git
- - name: package
- shell: msys2 {0}
- run: |
- set -euo pipefail
- if [ "$IS_TAG" = "true" ]; then
- ./scripts/dist/package.sh windows x32 --noconfirm
- else
- ./scripts/dist/package.sh windows x32 --branch "${BRANCH}" --noconfirm
- fi
- - name: upload-dist
- uses: actions/upload-artifact@v4
- with:
- name: dist-windows-x32
- path: dist-windows-x32.tar.gz
- retention-days: 1
- finalize:
- needs:
- - android-arm
- - android-arm64
- - html5-wasm
- - linux-x64
- - windows-x64
- - windows-x32
- - detect
- runs-on: ubuntu-22.04
- env:
- IS_TAG: ${{ needs.detect.outputs.is_tag }}
- VERSION: ${{ needs.detect.outputs.version }}
- BRANCH: ${{ needs.detect.outputs.branch }}
- steps:
- - name: prepare
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- ref: ${{ github.ref }}
- - name: detect
- run: |
- set -euo pipefail
- echo "IS_TAG=${IS_TAG}" >> $GITHUB_ENV
- echo "VERSION=${VERSION}" >> $GITHUB_ENV
- echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
- - name: download-artifacts
- uses: actions/download-artifact@v4
- with:
- path: ./artifacts_dist
- - name: merge
- run: |
- set -euo pipefail
- # Uncompress.
- mkdir -p dist
- for ad in ./artifacts_dist/*; do
- if [ -d "$ad" ]; then
- for f in "$ad"/*.tar.gz; do
- if [ -f "$f" ]; then
- mkdir -p "$ad/extracted"
- tar -xzf "$f" -C "$ad/extracted"
- fi
- done
- cp -a "$ad/extracted/dist/"* ./dist/
- fi
- done
- # Merge.
- find ./artifacts_dist -maxdepth 3 -type d -name 'crown-*' -exec cp -a {} ./dist/ \;
- - name: detect-version
- run: |
- set -euo pipefail
- . ./scripts/dist/version.sh
- CROWN_VER=$(crown_version)
- if [ "${IS_TAG}" = "true" ]; then
- VERSIONNAME=crown-${CROWN_VER}
- else
- SUFFIX="$(git rev-parse --short HEAD)"
- VERSIONNAME=crown-${CROWN_VER}-${BRANCH}-${SUFFIX}
- fi
- DIST_DIR="dist/${VERSIONNAME}"
- echo "DIST_DIR=$DIST_DIR" >> $GITHUB_ENV
- echo "VERSIONNAME=$VERSIONNAME" >> $GITHUB_ENV
- - name: finalize
- run: |
- set -euo pipefail
- "$GITHUB_WORKSPACE/scripts/dist/finalize.sh" "${DIST_DIR}"
- - name: sums
- run: |
- set -euo pipefail
- "$GITHUB_WORKSPACE/scripts/dist/sums.sh" "${DIST_DIR}"
- - name: unstable
- if: env.IS_TAG == 'false'
- uses: Jumbo810/[email protected]
- with:
- target: ${{ env.DIST_DIR }}/*
- parent_folder_id: ${{ secrets.GDRIVE_PARENT_FOLDER_ID }}
- child_folder: ${{ env.VERSIONNAME }}
- credentials: ${{ secrets.GDRIVE_KEY }}
- - name: stable
- if: env.IS_TAG == 'true'
- uses: softprops/action-gh-release@v2
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- files: ${{ env.DIST_DIR }}/*
|