88 description : ' The output of the complete_version of the "determine_version" job from the build_and_release.yml workflow'
99 required : true
1010 type : string
11- release_upload_url :
11+ release_id :
1212 description : ' The output of the "create_release" job from the build_and_release.yml workflow'
1313 required : true
1414 type : string
1919
2020jobs :
2121 # Decide if we need to build the containers on this run
22- determine_docker_build :
22+ determine_docker_version :
2323 name : Determine whether to build the containers or not
2424 runs-on : ubuntu-latest
2525 outputs :
26- build_docker_containers : ${{ steps.docker_check.outputs.build_docker_containers }}
26+ build_docker_containers : ${{ steps.version.outputs.build_docker_containers }}
27+ build_debian_containers : ${{ steps.version.outputs.build_debian_containers }}
28+ build_ubuntu_containers : ${{ steps.version.outputs.build_ubuntu_containers }}
29+ build_fedora_containers : ${{ steps.version.outputs.build_fedora_containers }}
2730 steps :
2831 - name : Checkout
2932 id : checkout
3033 uses : actions/checkout@v3
3134 with :
3235 fetch-depth : 0
3336
34- - name : Build docker check
35- id : docker_check
37+ - name : Determine version
38+ id : version
3639 run : |
3740 # Only run the container builds when something in the docker folder or
3841 # this workflow has changed from master, or if it was cron triggered
39- GIT_OUTPUT="$(git log -n 2 --stat)"
40- if [ $(echo ${GIT_OUTPUT} | grep -c docker/) -gt 0 ] || [ $(echo ${GIT_OUTPUT} | grep -c .github/workflows/linux.yml) -gt 0 ] || [ '${{ github.event_name }}' = 'schedule' ]; then
42+ if [[ '${{ github.event_name }}' == 'push' ]]; then
43+ base_version='${{ github.event.before }}'
44+ else
45+ base_version='origin/master'
46+ fi
47+ DIFF_YML=$((git rev-parse HEAD:.github/workflows/linux.yml && git diff --merge-base ${base_version} --exit-code -- .github/workflows/linux.yml) > /dev/null 2>&1 ; echo $?)
48+ if [[ $DIFF_YML != 0 || '${{ github.event_name }}' == 'schedule' ]]; then
49+ echo "Refresh all containers: TRUE"
4150 echo "build_docker_containers=true" >> $GITHUB_OUTPUT
4251 else
52+ echo "Refresh all containers: FALSE"
4353 echo "build_docker_containers=false" >> $GITHUB_OUTPUT
4454 fi
4555
56+ DIFF_UBUNTU=$((git rev-parse HEAD:docker/Dockerfile.ubuntu HEAD:docker/build_performous.sh && git diff --merge-base ${base_version} --exit-code -- docker/Dockerfile.ubuntu docker/build_performous.sh) > /dev/null 2>&1 ; echo $?)
57+ DIFF_DEBIAN=$((git rev-parse HEAD:docker/Dockerfile.debian HEAD:docker/build_performous.sh && git diff --merge-base ${base_version} --exit-code -- docker/Dockerfile.debian docker/build_performous.sh) > /dev/null 2>&1 ; echo $?)
58+ DIFF_FEDORA=$((git rev-parse HEAD:docker/Dockerfile.fedora HEAD:docker/build_performous.sh && git diff --merge-base ${base_version} --exit-code -- docker/Dockerfile.fedora docker/build_performous.sh) > /dev/null 2>&1 ; echo $?)
59+
60+ if [[ $DIFF_UBUNTU != 0 ]]; then
61+ echo "Refresh Ubuntu containers: TRUE"
62+ echo "build_ubuntu_containers=true" >> $GITHUB_OUTPUT
63+ else
64+ echo "Refresh Ubuntu containers: FALSE"
65+ echo "build_ubuntu_containers=false" >> $GITHUB_OUTPUT
66+ fi
67+
68+ if [[ $DIFF_FEDORA != 0 ]]; then
69+ echo "Refresh FEDORA containers: TRUE"
70+ echo "build_fedora_containers=true" >> $GITHUB_OUTPUT
71+ else
72+ echo "Refresh FEDORA containers: FALSE"
73+ echo "build_fedora_containers=false" >> $GITHUB_OUTPUT
74+ fi
75+
76+ if [[ $DIFF_DEBIAN != 0 ]]; then
77+ echo "Refresh DEBIAN containers: TRUE"
78+ echo "build_debian_containers=true" >> $GITHUB_OUTPUT
79+ else
80+ echo "Refresh DEBIAN containers: FALSE"
81+ echo "build_debian_containers=false" >> $GITHUB_OUTPUT
82+ fi
83+
4684 build_packages :
4785 name : Build the Linux packages
4886 runs-on : ubuntu-latest
4987 needs :
50- - determine_docker_build
88+ - determine_docker_version
5189 strategy :
5290 matrix :
5391 include :
5997 version : 10
6098 - os : debian
6199 version : 11
100+ - os : debian
101+ version : 12
62102 - os : fedora
63103 version : 35
64104 # # FFMPEG5 causes issues
75115 - name : Container name
76116 run : |
77117 # Figure out the container name we'll use for the build
78- BUILD_CONTAINER=${{ env.REGISTRY }}/${{ env.REPO_NAME }}/composer- deps:${{ matrix.os }}-${{ matrix.version }}
118+ BUILD_CONTAINER=${{ env.REGISTRY }}/${{ env.REPO_NAME }}/deps:${{ matrix.os }}-${{ matrix.version }}
79119 echo "CONTAINER_NAME=${BUILD_CONTAINER}" >> $GITHUB_ENV
80120
81121 - name : Checkout
89129 password : ${{ secrets.GITHUB_TOKEN }}
90130
91131 - name : Build ${{ matrix.os }} ${{ matrix.version }} Container
92- if : ${{ needs.determine_docker_build .outputs. build_docker_containers == 'true' }}
132+ if : needs.determine_docker_version.outputs[format('build_{0}_containers', matrix.os)] == 'true' || needs.determine_docker_version .outputs[' build_docker_containers'] == 'true'
93133 uses : docker/build-push-action@v3
94134 with :
95135 context : docker/
@@ -106,25 +146,19 @@ jobs:
106146 # Set the correct version in cmake
107147 PACKAGE_VERSION=${{ inputs.package_complete_version }}
108148 EXTRA_CMAKE_ARGS="-DCOMPOSER_VERSION=${PACKAGE_VERSION}"
109-
110- # Decide if we should build a 'Release' package or a 'RelWithDebInfo' (default)
111- # For some reason, building with 'RelWithDebInfo' (default) doesn't work
112- # specifically on PRs, so we'll just build Releases for everything for now
113- #if [ '${{ github.event_name }}' != 'pull_request' ]; then
114- RELEASE_TYPE="-R"
115- #fi
149+ COMPOSER_RELEASE_TYPE="RelWithDebInfo"
116150
117151 # Only pull the container if it wasn't built locally
118- if [ '${{ needs.determine_docker_build .outputs.build_docker_containers }}' = 'false' ]; then
152+ if [ '${{ needs.determine_docker_version .outputs.build_docker_containers }}' = 'false' ]; then
119153 docker pull ${{ env.CONTAINER_NAME }}
120154 fi
121155
122156 # Run the build inside the docker containers using the
123157 # build script that was pulled inside during the build
124- docker run --rm -v $(pwd):/github_actions_build/ ${{ env.CONTAINER_NAME }} ./build_composer.sh -g -D /github_actions_build/ -E ${EXTRA_CMAKE_ARGS} ${RELEASE_TYPE }
158+ docker run --env EXTRA_CMAKE_ARGS -- rm -v $(pwd):/github_actions_build/ ${{ env.CONTAINER_NAME }} ./build_composer.sh -g -D /github_actions_build/ -E ${EXTRA_CMAKE_ARGS} -R ${COMPOSER_RELEASE_TYPE }
125159
126160 ## Provided by the common build functions
127- package_name "$(pwd)/build" "Composer*64 .*" "${PACKAGE_VERSION}" "${{ matrix.os }}" "${{ matrix.version }}"
161+ package_name "$(pwd)/build" "Composer*Linux .*" "${PACKAGE_VERSION}" "${{ matrix.os }}" "${{ matrix.version }}"
128162
129163 # - name: Run unit tests
130164 # run: |
@@ -151,20 +185,18 @@ jobs:
151185 - name : Upload artifacts to tagged release
152186 id : upload_assets
153187 if : ${{ github.event_name != 'pull_request' && github.ref_type == 'tag' }}
154- uses : actions /upload-release-asset @v1
188+ uses : xresloader /upload-to-github-release @v1
155189 env :
156190 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
157191 with :
158- upload_url : ${{ inputs.release_upload_url }}
159- asset_path : ${{ env.ARTIFACT_PATH }}
160- asset_name : ${{ env.ARTIFACT_NAME }}
161- asset_content_type : application/octet-stream
192+ release_id : ${{ inputs.release_id }}
193+ file : ${{ env.ARTIFACT_PATH }}
162194
163195 - name : Push container
164196 uses : docker/build-push-action@v3
165197 # Containers can't be pushed during PRs because of the way permissions
166198 # are delegated to secrets.GITHUB_TOKEN
167- if : ${{ needs.determine_docker_build .outputs.build_docker_containers == 'true' && github.event_name != 'pull_request' }}
199+ if : ${{ needs.determine_docker_version .outputs.build_docker_containers == 'true' && github.event_name != 'pull_request' }}
168200 with :
169201 context : docker/
170202 file : ./docker/Dockerfile.${{ matrix.os }}
0 commit comments