|
| 1 | +# Author: Kang Lin <kl222@126.com> |
| 2 | + |
| 3 | +name: deepin |
| 4 | + |
| 5 | +on: |
| 6 | + workflow_call: |
| 7 | + outputs: |
| 8 | + name: |
| 9 | + description: "The artifact name" |
| 10 | + value: ${{ jobs.build_deepin.outputs.name }} |
| 11 | + |
| 12 | +env: |
| 13 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 14 | + |
| 15 | +jobs: |
| 16 | + build_deepin: |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + BUILD_TYPE: [Release] |
| 20 | + os: [ubuntu-24.04, ubuntu-24.04-arm] |
| 21 | + |
| 22 | + # See: [About GitHub-hosted runners](https://docs.github.com/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners) |
| 23 | + # See: [Choosing the runner for a job](https://docs.github.com/actions/writing-workflows/choosing-where-your-workflow-runs/choosing-the-runner-for-a-job) |
| 24 | + # See: https://github.com/actions/runner-images/ |
| 25 | + runs-on: ${{matrix.os}} |
| 26 | + container: |
| 27 | + # 使用 Deepin 23 官方基础镜像作为构建环境 |
| 28 | + image: linuxdeepin/beige:latest |
| 29 | + # 赋予必要的权限,以便 apt 等工具正常工作 |
| 30 | + options: --privileged |
| 31 | + |
| 32 | + env: |
| 33 | + BUILD_TYPE: ${{matrix.BUILD_TYPE}} |
| 34 | + BUILD_DIR: ${{github.workspace}}/build |
| 35 | + SOURCE_DIR: ${{github.workspace}}/.cache/source |
| 36 | + TOOLS_DIR: ${{github.workspace}}/.cache/tools |
| 37 | + INSTALL_DIR: ${{github.workspace}}/.cache/install_${{matrix.os}}_${{matrix.BUILD_TYPE}} |
| 38 | + RabbitRemoteControl_VERSION: 0.1.0-dev |
| 39 | + artifact_name: build_deepin |
| 40 | + |
| 41 | + # Map the job outputs to step outputs |
| 42 | + outputs: |
| 43 | + name: ${{ env.artifact_name }} |
| 44 | + |
| 45 | + steps: |
| 46 | + - name: Checkout Repository |
| 47 | + uses: actions/checkout@v4 |
| 48 | + with: |
| 49 | + submodules: true |
| 50 | + fetch-depth: 0 |
| 51 | + |
| 52 | + - name: Make directories |
| 53 | + run: | |
| 54 | + cmake -E make_directory ${{env.BUILD_DIR}} |
| 55 | + cmake -E make_directory ${{env.SOURCE_DIR}} |
| 56 | + cmake -E make_directory ${{env.TOOLS_DIR}} |
| 57 | + cmake -E make_directory ${{env.INSTALL_DIR}} |
| 58 | +
|
| 59 | + - name: Cache installed |
| 60 | + uses: actions/cache@v4 |
| 61 | + id: cache-installed |
| 62 | + with: |
| 63 | + path: | |
| 64 | + ${{env.INSTALL_DIR}} |
| 65 | + key: install_deepin_${{matrix.os}} |
| 66 | + |
| 67 | + - name: build_linux.sh |
| 68 | + working-directory: ${{github.workspace}} |
| 69 | + run: | |
| 70 | + ./Script/build_linux.sh --deb |
| 71 | + ARCH=`dpkg --print-architecture` |
| 72 | + cp ../rabbitremotecontrol_${{env.RabbitRemoteControl_VERSION}}_${ARCH}.deb rabbitremotecontrol_${{env.RabbitRemoteControl_VERSION}}_deepin_${ARCH}.deb |
| 73 | +
|
| 74 | + - name: Update artifact |
| 75 | + if: ${{ matrix.BUILD_TYPE == 'Release' }} |
| 76 | + uses: actions/upload-artifact@v4 |
| 77 | + with: |
| 78 | + name: ${{ env.artifact_name }}_${{matrix.os}} |
| 79 | + path: | |
| 80 | + ${{github.workspace}}/rabbitremotecontrol_*.deb |
0 commit comments