[ci] fix gha ubuntu runner version issue for docker release #17
Workflow file for this run
This file contains hidden or 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: Release ZTM Cli | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| - 'v*.*.*-*' | |
| - '*.*.*' | |
| - '*.*.*-*' | |
| env: | |
| PACKAGE_OUTPUT: true | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| set-release-version: | |
| name: set-release-version | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set RELEASE_VERSION | |
| id: version | |
| run: | | |
| pwd | |
| ls -l | |
| CI_COMMIT_DATE=$(git log -1 --format="%ad" --date=format:"%Y%m%d%H%M") | |
| echo "CI_COMMIT_DATE=${CI_COMMIT_DATE}" >> $GITHUB_ENV | |
| git fetch --tags | |
| RELEASE_VERSION=`git name-rev --tags --name-only $(git rev-parse HEAD)` | |
| if [ $RELEASE_VERSION = 'undefined' ] | |
| then | |
| echo "release_version=nightly-${CI_COMMIT_DATE}" >> $GITHUB_OUTPUT | |
| echo "version=nightly" >> $GITHUB_OUTPUT | |
| echo "commit_date=${CI_COMMIT_DATE}" >> $GITHUB_OUTPUT | |
| else | |
| echo "release_version=${RELEASE_VERSION}" >> $GITHUB_OUTPUT | |
| echo "commit_date=${CI_COMMIT_DATE}" >> $GITHUB_OUTPUT | |
| fi | |
| CI_COMMIT_SHA=$(git log -1 --format=%H) | |
| echo "commit_sha=$CI_COMMIT_SHA" >> $GITHUB_OUTPUT | |
| - name: Show envs | |
| run: export | |
| outputs: | |
| release_version: ${{steps.version.outputs.release_version}} | |
| commit_date: ${{steps.version.outputs.commit_date}} | |
| commit_sha: ${{steps.version.outputs.commit_sha}} | |
| archive-ztm-src: | |
| needs: set-release-version | |
| name: archive-ztm-src | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build | |
| id: build | |
| env: | |
| RELEASE_VERSION: ${{ needs.set-release-version.outputs.release_version }} | |
| ZTM_VERSION: ${{needs.set-release-version.outputs.release_version}} | |
| ZTM_COMMIT_SHA: ${{needs.set-release-version.outputs.commit_sha}} | |
| ZTM_COMMIT_DATE: ${{needs.set-release-version.outputs.commit_date}} | |
| run: | | |
| set -x | |
| curl -LO https://github.com/fabacab/git-archive-all.sh/raw/refs/heads/master/git-archive-all.sh | |
| chmod +x git-archive-all.sh | |
| ./git-archive-all.sh --prefix ztm-src-${ZTM_VERSION}/ ztm-src-${ZTM_VERSION}.tar | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ztm-src-${{needs.set-release-version.outputs.release_version}}.tar | |
| path: ztm-src-${{needs.set-release-version.outputs.release_version}}.tar | |
| build-ztm-aio-linux-x86_64: | |
| needs: set-release-version | |
| name: build-ztm-aio-linux-x86_64 | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Build | |
| id: build | |
| env: | |
| RELEASE_VERSION: ${{ needs.set-release-version.outputs.release_version }} | |
| ZTM_VERSION: ${{needs.set-release-version.outputs.release_version}} | |
| ZTM_COMMIT_SHA: ${{needs.set-release-version.outputs.commit_sha}} | |
| ZTM_COMMIT_DATE: ${{needs.set-release-version.outputs.commit_date}} | |
| run: | | |
| set -x | |
| ./build.sh | |
| ls -al | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ztm-aio-${{needs.set-release-version.outputs.release_version}}-generic_linux-x86_64.tar.gz | |
| path: ztm-aio-${{needs.set-release-version.outputs.release_version}}-generic_linux-x86_64.tar.gz | |
| build-ztm-aio-linux-arm64: | |
| needs: set-release-version | |
| name: build-ztm-aio-linux-arm64 | |
| runs-on: [self-hosted, linux, ARM64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Build | |
| id: build | |
| env: | |
| RELEASE_VERSION: ${{ needs.set-release-version.outputs.release_version }} | |
| ZTM_VERSION: ${{needs.set-release-version.outputs.release_version}} | |
| ZTM_COMMIT_SHA: ${{needs.set-release-version.outputs.commit_sha}} | |
| ZTM_COMMIT_DATE: ${{needs.set-release-version.outputs.commit_date}} | |
| run: | | |
| set -x | |
| ./build.sh | |
| ls -al | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ztm-aio-${{needs.set-release-version.outputs.release_version}}-generic_linux-arm64.tar.gz | |
| path: ztm-aio-${{needs.set-release-version.outputs.release_version}}-generic_linux-arm64.tar.gz | |
| build-ztm-aio-macos-x86_64: | |
| needs: set-release-version | |
| name: build-ztm-aio-macos-x86_64 | |
| runs-on: macos-13 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Build | |
| id: build | |
| env: | |
| RELEASE_VERSION: ${{ needs.set-release-version.outputs.release_version }} | |
| ZTM_VERSION: ${{needs.set-release-version.outputs.release_version}} | |
| ZTM_COMMIT_SHA: ${{needs.set-release-version.outputs.commit_sha}} | |
| ZTM_COMMIT_DATE: ${{needs.set-release-version.outputs.commit_date}} | |
| run: | | |
| set -x | |
| ./build.sh | |
| ls -al | |
| uname -m | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ztm-aio-${{needs.set-release-version.outputs.release_version}}-macos-x86_64.tar.gz | |
| path: ztm-aio-${{needs.set-release-version.outputs.release_version}}-macos-x86_64.tar.gz | |
| build-ztm-aio-macos-arm64: | |
| needs: set-release-version | |
| name: build-ztm-aio-macos-arm64 | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Build | |
| id: build | |
| env: | |
| RELEASE_VERSION: ${{ needs.set-release-version.outputs.release_version }} | |
| ZTM_VERSION: ${{needs.set-release-version.outputs.release_version}} | |
| ZTM_COMMIT_SHA: ${{needs.set-release-version.outputs.commit_sha}} | |
| ZTM_COMMIT_DATE: ${{needs.set-release-version.outputs.commit_date}} | |
| run: | | |
| set -x | |
| ./build.sh | |
| ls -al | |
| uname -m | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ztm-aio-${{needs.set-release-version.outputs.release_version}}-macos-arm64.tar.gz | |
| path: ztm-aio-${{needs.set-release-version.outputs.release_version}}-macos-arm64.tar.gz | |
| build-ztm-aio-win-x86_64: | |
| needs: set-release-version | |
| name: build-ztm-aio-win-x86_64 | |
| runs-on: windows-latest | |
| defaults: | |
| run: | |
| shell: cmd | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Add msbuild to PATH | |
| uses: microsoft/setup-msbuild@v2 | |
| with: | |
| msbuild-architecture: x64 | |
| - uses: lukka/get-cmake@latest | |
| with: | |
| cmakeVersion: "~3.25.0" | |
| ninjaVersion: "^1.11.1" | |
| - name: Install NASM | |
| uses: ilammy/setup-nasm@v1 | |
| - name: Build | |
| id: build | |
| env: | |
| RELEASE_VERSION: ${{ needs.set-release-version.outputs.release_version }} | |
| ZTM_VERSION: ${{needs.set-release-version.outputs.release_version}} | |
| ZTM_COMMIT_SHA: ${{needs.set-release-version.outputs.commit_sha}} | |
| ZTM_COMMIT_DATE: ${{needs.set-release-version.outputs.commit_date}} | |
| run: | | |
| .\build.cmd | |
| dir | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ztm-aio-${{needs.set-release-version.outputs.release_version}}-win-x86_64.tar | |
| path: ztm-aio-${{needs.set-release-version.outputs.release_version}}-win-x86_64.tar | |
| build-libztm-android: | |
| needs: set-release-version | |
| name: build-libztm-android | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - uses: nttld/setup-ndk@v1 | |
| id: setup-ndk | |
| with: | |
| ndk-version: r26c | |
| - uses: seanmiddleditch/gha-setup-ninja@v5 | |
| id: setup-ninja | |
| with: | |
| version: 1.11.1 | |
| - name: Build | |
| id: build | |
| env: | |
| RELEASE_VERSION: ${{ needs.set-release-version.outputs.release_version }} | |
| ZTM_VERSION: ${{needs.set-release-version.outputs.release_version}} | |
| ZTM_COMMIT_SHA: ${{needs.set-release-version.outputs.commit_sha}} | |
| ZTM_COMMIT_DATE: ${{needs.set-release-version.outputs.commit_date}} | |
| BUILD_ZTM_SHARED: true | |
| NDK: "${{ steps.setup-ndk.outputs.ndk-path }}" | |
| run: | | |
| set -x | |
| ./build.sh | |
| ls -al | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libztm-${{needs.set-release-version.outputs.release_version}}-android.tar.gz | |
| path: libztm-${{needs.set-release-version.outputs.release_version}}-android.tar.gz | |
| create-release: | |
| name: create release | |
| runs-on: ubuntu-22.04 | |
| needs: | |
| - set-release-version | |
| - build-ztm-aio-linux-x86_64 | |
| - build-ztm-aio-linux-arm64 | |
| - build-ztm-aio-macos-x86_64 | |
| - build-ztm-aio-macos-arm64 | |
| - build-ztm-aio-win-x86_64 | |
| - build-libztm-android | |
| - archive-ztm-src | |
| env: | |
| ZTM_VERSION: ${{needs.set-release-version.outputs.release_version}} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Check downloads | |
| run: | | |
| ls -alR | |
| - name: Create draft release | |
| id: create_release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| draft: true | |
| tag_name: ${{needs.set-release-version.outputs.release_version}} | |
| files: | | |
| ztm-aio-${{env.ZTM_VERSION}}-generic_linux-x86_64.tar.gz/ztm-aio-${{env.ZTM_VERSION}}-generic_linux-x86_64.tar.gz | |
| ztm-aio-${{env.ZTM_VERSION}}-generic_linux-arm64.tar.gz/ztm-aio-${{env.ZTM_VERSION}}-generic_linux-arm64.tar.gz | |
| ztm-aio-${{env.ZTM_VERSION}}-macos-x86_64.tar.gz/ztm-aio-${{env.ZTM_VERSION}}-macos-x86_64.tar.gz | |
| ztm-aio-${{env.ZTM_VERSION}}-macos-arm64.tar.gz/ztm-aio-${{env.ZTM_VERSION}}-macos-arm64.tar.gz | |
| ztm-aio-${{env.ZTM_VERSION}}-win-x86_64.tar/ztm-aio-${{env.ZTM_VERSION}}-win-x86_64.tar | |
| libztm-${{env.ZTM_VERSION}}-android.tar.gz/libztm-${{env.ZTM_VERSION}}-android.tar.gz | |
| ztm-src-${{needs.set-release-version.outputs.release_version}}.tar/ztm-src-${{needs.set-release-version.outputs.release_version}}.tar |