Use Architecture: any instead of @ARCHITECTURE@ placeholder #22
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: Build and Deploy libm2k | |
| permissions: | |
| contents: read | |
| env: | |
| APP_NAME: libm2k | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - '20[1-9][0-9]_R[1-9]' | |
| - staging/* | |
| pull_request: | |
| branches: | |
| - main | |
| - '20[1-9][0-9]_R[1-9]' | |
| jobs: | |
| identify_version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| app-version: ${{ steps.set_version.outputs.version }} | |
| steps: | |
| - name: Checkout code repository | |
| uses: actions/checkout@v6 | |
| - name: Set app version | |
| id: set_version | |
| run: | | |
| # Extract version from CMakeLists.txt LIBM2K_VERSION_MAJOR/MINOR/PATCH variables | |
| cmake_version=$(grep -oP 'set\s*\(\s*LIBM2K_VERSION_(MAJOR|MINOR|PATCH)\s+\K[0-9]+' CMakeLists.txt | paste -sd '.') | |
| if [[ -z "$cmake_version" ]]; then | |
| echo "Failed to extract version from CMakeLists.txt, using default" | |
| cmake_version="0.0.1+${{ github.sha }}" | |
| fi | |
| echo "Version to use: $cmake_version" | |
| echo "version=$cmake_version" >> "$GITHUB_OUTPUT" | |
| build_arm_native: | |
| runs-on: ubuntu-24.04-arm | |
| needs: identify_version | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - docker_image: arm64v8/debian:trixie | |
| distro: debian13 | |
| architecture: arm64 | |
| platform_flag: "" | |
| - docker_image: arm32v7/debian:trixie | |
| distro: debian13 | |
| architecture: armhf | |
| platform_flag: "--platform linux/arm/v7" | |
| steps: | |
| - name: Checkout code repository | |
| uses: actions/checkout@v6 | |
| with: | |
| path: ${{env.APP_NAME}} | |
| - name: Start persistent container | |
| run: | | |
| docker run -d \ | |
| ${{matrix.platform_flag}} \ | |
| --name ${{matrix.distro}}-${{matrix.architecture}} \ | |
| -v "$GITHUB_WORKSPACE/${{env.APP_NAME}}:/workspace/${{env.APP_NAME}}" \ | |
| -w /workspace/${{env.APP_NAME}} \ | |
| ${{matrix.docker_image}} tail -f /dev/null | |
| - name: Create debian package | |
| run: | | |
| docker exec ${{matrix.distro}}-${{matrix.architecture}} sh -c ".github/scripts/create_debian.sh ${{needs.identify_version.outputs.app-version}}" | |
| - name: Copy debian artifacts from container to host | |
| run: | | |
| docker cp ${{matrix.distro}}-${{matrix.architecture}}:/workspace/. ./artifacts/ | |
| ls -la ./artifacts/ | |
| - name: Upload debian artifacts to github | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{env.APP_NAME}}-${{matrix.distro}}-${{matrix.architecture}} | |
| path: | | |
| artifacts/*.deb | |
| artifacts/*.dsc | |
| artifacts/*.debian.tar.xz | |
| artifacts/*.orig.tar.gz | |
| if-no-files-found: error | |
| build_ubuntu: | |
| runs-on: ubuntu-latest | |
| needs: identify_version | |
| env: | |
| architecture: amd64 | |
| defaults: | |
| run: | |
| working-directory: ${{env.APP_NAME}} | |
| steps: | |
| - name: Checkout code repository | |
| uses: actions/checkout@v6 | |
| with: | |
| path: ${{env.APP_NAME}} | |
| - name: Create .deb package | |
| run: | | |
| .github/scripts/create_debian.sh ${{needs.identify_version.outputs.app-version}} | |
| - name: Copy debian artifacts | |
| run: | | |
| mkdir -p artifacts | |
| cp ../*.deb ../*.dsc ../*.debian.tar.xz ../*.orig.tar.gz artifacts/ | |
| ls -la artifacts/ | |
| - name: Upload debian artifacts to github | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{env.APP_NAME}}-ubuntu | |
| path: | | |
| ${{env.APP_NAME}}/artifacts/*.deb | |
| ${{env.APP_NAME}}/artifacts/*.dsc | |
| ${{env.APP_NAME}}/artifacts/*.debian.tar.xz | |
| ${{env.APP_NAME}}/artifacts/*.orig.tar.gz | |
| if-no-files-found: error |