From de5ede4d4759a9b85e73a46b672e7d440d9a2b3c Mon Sep 17 00:00:00 2001 From: homebot Date: Sat, 20 Jan 2024 23:58:58 +0100 Subject: [PATCH] Reintroduce RC builds - `is_release_build` is ignored except if the workflow executes on a `releases/v` branch - `is_release_build` is false by default and creates RC builds that increment when a new commit is detected - simplify workflow by using environment variables --- .github/workflows/artifacts_build_deploy.yml | 60 ++++++++++---------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/.github/workflows/artifacts_build_deploy.yml b/.github/workflows/artifacts_build_deploy.yml index 24de26309f..2d1f1aa452 100644 --- a/.github/workflows/artifacts_build_deploy.yml +++ b/.github/workflows/artifacts_build_deploy.yml @@ -3,6 +3,11 @@ on: schedule: - cron: "0 0 * * 3,6" workflow_dispatch: + inputs: + is_release_build: + description: 'Is this a release build?' + required: false + default: 'false' env: artifact: 1 @@ -11,28 +16,25 @@ jobs: prepare_build: runs-on: ubuntu-22.04 outputs: - CI_TAG: ${{ steps.tag_set.outputs.CI_TAG }} - TAG_CREATED: ${{ steps.tag_set.outputs.tag_created }} + ci_tag: ${{ steps.tag_set.outputs.ci_tag }} + tag_created: ${{ steps.tag_set.outputs.tag_created }} steps: - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 - with: - ref: ${{ github.ref }} - name: Set the tag and version id: tag_set run: | - output_var_file="variable_list.txt" - ci/actions/generate_next_git_tag.sh -c -o "${output_var_file}" - CI_TAG=$(grep 'build_tag' ${output_var_file} | cut -d= -f2) - echo "CI_TAG=${CI_TAG}" >> $GITHUB_OUTPUT - TAG_CREATED=$(grep 'tag_created' ${output_var_file} | cut -d= -f2) - echo "TAG_CREATED=${TAG_CREATED}" >> $GITHUB_OUTPUT + ci/actions/generate_next_git_tag.sh -c + echo "ci_tag=$CI_TAG" >> $GITHUB_OUTPUT + echo "tag_created=$TAG_CREATED" >> $GITHUB_OUTPUT env: GITHUB_ACTOR: ${{ github.actor }} + IS_RELEASE_BUILD: ${{ github.event.inputs.is_release_build || 'false' }} + osx_job: needs: prepare_build - if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }} + if: ${{ needs.prepare_build.outputs.tag_created == 'true' }} runs-on: macOS-12 timeout-minutes: 90 strategy: @@ -43,7 +45,7 @@ jobs: - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 with: submodules: "recursive" - ref: ${{ needs.prepare_build.outputs.CI_TAG }} + ref: ${{ needs.prepare_build.outputs.ci_tag }} repository: ${{ github.repository }} - name: Prepare run: ci/prepare/macos/prepare.sh @@ -51,12 +53,12 @@ jobs: run: ci/build-deploy.sh "/tmp/qt/lib/cmake/Qt5"; env: NETWORK: ${{ matrix.network }} - CI_TAG: ${{ needs.prepare_build.outputs.CI_TAG }} + CI_TAG: ${{ needs.prepare_build.outputs.ci_tag }} - name: Deploy Artifact run: ci/actions/deploy.sh env: NETWORK: ${{ matrix.network }} - TAG: ${{ needs.prepare_build.outputs.CI_TAG }} + TAG: ${{ needs.prepare_build.outputs.ci_tag }} S3_BUCKET_NAME: ${{ vars.S3_BUCKET_NAME }} S3_BUILD_DIRECTORY: ${{ vars.S3_BUILD_DIRECTORY }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} @@ -66,7 +68,7 @@ jobs: linux_job: needs: prepare_build - if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }} + if: ${{ needs.prepare_build.outputs.tag_created == 'true' }} runs-on: ubuntu-22.04 timeout-minutes: 90 strategy: @@ -76,7 +78,7 @@ jobs: - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 with: submodules: "recursive" - ref: ${{ needs.prepare_build.outputs.CI_TAG }} + ref: ${{ needs.prepare_build.outputs.ci_tag }} repository: ${{ github.repository }} - name: Prepare run: sudo -E ci/prepare/linux/prepare.sh @@ -84,13 +86,13 @@ jobs: run: ci/build-deploy.sh "/usr/lib/x86_64-linux-gnu/cmake/Qt5" env: NETWORK: ${{ matrix.network }} - CI_TAG: ${{ needs.prepare_build.outputs.CI_TAG }} + CI_TAG: ${{ needs.prepare_build.outputs.ci_tag }} - name: Deploy Artifact run: ci/actions/deploy.sh env: NETWORK: ${{ matrix.network }} - TAG: ${{ needs.prepare_build.outputs.CI_TAG }} + TAG: ${{ needs.prepare_build.outputs.ci_tag }} S3_BUCKET_NAME: ${{ vars.S3_BUCKET_NAME }} S3_BUILD_DIRECTORY: ${{ vars.S3_BUILD_DIRECTORY }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} @@ -100,7 +102,7 @@ jobs: linux_rpm_job: needs: prepare_build - if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }} + if: ${{ needs.prepare_build.outputs.tag_created == 'true' }} runs-on: ubuntu-22.04 timeout-minutes: 90 strategy: @@ -125,7 +127,7 @@ jobs: docker run -v ${GITHUB_WORKSPACE}:/workspace -v ${GITHUB_WORKSPACE}/artifacts:/root/rpmbuild \ local/nano-env:rhel /bin/bash -c " \ NETWORK=${{ matrix.network }} \ - TAG=${{ needs.prepare_build.outputs.CI_TAG }} \ + TAG=${{ needs.prepare_build.outputs.ci_tag }} \ REPO_TO_BUILD=${{ github.repository }} \ RPM_RELEASE=1 \ ci/build-rhel.sh" @@ -135,7 +137,7 @@ jobs: env: LINUX_RPM: 1 NETWORK: ${{ matrix.network }} - # TAG: ${{ needs.prepare_build.outputs.CI_TAG }} # (not used in the deploy script if LINUX_RPM==1 ) + # TAG: ${{ needs.prepare_build.outputs.ci_tag }} # (not used in the deploy script if LINUX_RPM==1 ) S3_BUCKET_NAME: ${{ vars.S3_BUCKET_NAME }} S3_BUILD_DIRECTORY: ${{ vars.S3_BUILD_DIRECTORY }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} @@ -145,7 +147,7 @@ jobs: linux_docker_job: needs: prepare_build - if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }} + if: ${{ needs.prepare_build.outputs.tag_created == 'true' }} runs-on: ubuntu-22.04 timeout-minutes: 90 strategy: @@ -155,13 +157,13 @@ jobs: - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 with: submodules: "recursive" - ref: ${{ needs.prepare_build.outputs.CI_TAG }} + ref: ${{ needs.prepare_build.outputs.ci_tag }} repository: ${{ github.repository }} - name: Build Docker run: ci/actions/linux/docker-build.sh env: NETWORK: ${{ matrix.network }} - CI_TAG: ${{ needs.prepare_build.outputs.CI_TAG }} + CI_TAG: ${{ needs.prepare_build.outputs.ci_tag }} DOCKER_REGISTRY: ${{ vars.DOCKER_REGISTRY }} - name: Check if secrets.DOCKER_PASSWORD exists run: echo "DOCKER_PASSWORD_EXISTS=${{ secrets.DOCKER_PASSWORD != '' }}" >> $GITHUB_ENV @@ -169,7 +171,7 @@ jobs: if: env.DOCKER_PASSWORD_EXISTS == 'true' run: ci/actions/linux/docker-deploy.sh env: - CI_TAG: ${{ needs.prepare_build.outputs.CI_TAG }} + CI_TAG: ${{ needs.prepare_build.outputs.ci_tag }} NETWORK: ${{ matrix.network }} DOCKER_REGISTRY: ${{ vars.DOCKER_REGISTRY }} DOCKER_USER: ${{ vars.DOCKER_USER }} @@ -177,7 +179,7 @@ jobs: - name: Deploy Docker (ghcr.io) run: ci/actions/linux/ghcr-deploy.sh env: - CI_TAG: ${{ needs.prepare_build.outputs.CI_TAG }} + CI_TAG: ${{ needs.prepare_build.outputs.ci_tag }} NETWORK: ${{ matrix.network }} DOCKER_REGISTRY: ghcr.io DOCKER_USER: ${{ github.repository_owner }} @@ -186,7 +188,7 @@ jobs: windows_job: needs: prepare_build - if: ${{ needs.prepare_build.outputs.TAG_CREATED == 'true' }} + if: ${{ needs.prepare_build.outputs.tag_created == 'true' }} runs-on: windows-latest timeout-minutes: 90 strategy: @@ -196,7 +198,7 @@ jobs: - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0 with: submodules: "recursive" - ref: ${{ needs.prepare_build.outputs.CI_TAG }} + ref: ${{ needs.prepare_build.outputs.ci_tag }} repository: ${{ github.repository }} - name: Prepare run: ci/prepare/windows/prepare.ps1 @@ -209,7 +211,7 @@ jobs: run: ci/actions/windows/deploy.ps1 env: NETWORK: ${{ matrix.network }} - TAG: ${{ needs.prepare_build.outputs.CI_TAG }} + TAG: ${{ needs.prepare_build.outputs.ci_tag }} S3_BUCKET_NAME: ${{ vars.S3_BUCKET_NAME }} S3_BUILD_DIRECTORY: ${{ vars.S3_BUILD_DIRECTORY }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}