From 9633e7501c3d36437a6de07b41541fbecd800744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 3 Jun 2025 12:27:18 +0300 Subject: [PATCH] github: Use dawidd6/action-download-artifact with the new ref: option This allows specifying either a commit or a branch in the same field, allowing simplifying both the workflow inputs, and the expressions for passing commit/branch to both dawidd6/action-download-artifact and actions/checkout. This new option is available since https://github.com/dawidd6/action-download-artifact/pull/329. --- .github/workflows/docker.yml | 21 ++++++++------------- .github/workflows/msvcrt.yml | 23 +++++++++-------------- .github/workflows/release.yml | 14 +++++--------- .github/workflows/test-libcxx.yml | 17 ++++++----------- .github/workflows/test-llvm.yml | 17 ++++++----------- 5 files changed, 34 insertions(+), 58 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 02a061b..411a20b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,11 +2,8 @@ name: Build docker images on: workflow_dispatch: inputs: - commit: - description: 'Commit to extract from' - type: string - branch: - description: 'Branch to extract from' + ref: + description: 'Ref to extract from' type: string default: 'master' login: @@ -25,12 +22,11 @@ jobs: TAG: ${{steps.get-parameters.outputs.TAG}} steps: - name: Download build parameters - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v10 with: workflow: build.yml workflow_conclusion: success - commit: ${{inputs.commit}} - branch: ${{inputs.commit == '' && inputs.branch || ''}} + ref: ${{inputs.ref}} event: push name: parameters - name: Get build parameters @@ -45,7 +41,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: ${{ (inputs.commit != '' && inputs.commit) || inputs.branch }} + ref: ${{inputs.ref}} - name: Log in to Docker Hub if: ${{inputs.login}} uses: docker/login-action@v3 @@ -77,15 +73,14 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: ${{ (inputs.commit != '' && inputs.commit) || inputs.branch }} + ref: ${{inputs.ref}} - name: Download toolchain if: ${{matrix.file == 'Dockerfile.toolchain'}} - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v10 with: workflow: build.yml workflow_conclusion: success - commit: ${{inputs.commit}} - branch: ${{inputs.commit == '' && inputs.branch || ''}} + ref: ${{inputs.ref}} event: push name: linux-ucrt-.* name_is_regexp: true diff --git a/.github/workflows/msvcrt.yml b/.github/workflows/msvcrt.yml index f93680a..9fb1276 100644 --- a/.github/workflows/msvcrt.yml +++ b/.github/workflows/msvcrt.yml @@ -2,11 +2,8 @@ name: Build msvcrt toolchains on: workflow_dispatch: inputs: - commit: - description: 'Commit to extract from' - type: string - branch: - description: 'Branch to extract from' + ref: + description: 'Ref to extract from' type: string default: 'master' upload: @@ -30,12 +27,11 @@ jobs: BUILD_DATE_UNIX: ${{steps.get-parameters.outputs.BUILD_DATE_UNIX}} steps: - name: Download build parameters - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v10 with: workflow: build.yml workflow_conclusion: success - commit: ${{inputs.commit}} - branch: ${{inputs.commit == '' && inputs.branch || ''}} + ref: ${{inputs.ref}} event: push name: parameters - name: Get build parameters @@ -51,14 +47,13 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: ${{ (inputs.commit != '' && inputs.commit) || inputs.branch }} + ref: ${{inputs.ref}} - name: Download toolchain - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v10 with: workflow: build.yml workflow_conclusion: success - commit: ${{inputs.commit}} - branch: ${{inputs.commit == '' && inputs.branch || ''}} + ref: ${{inputs.ref}} event: push name: linux-ucrt-x86_64-toolchain - name: Unpack original toolchain @@ -110,7 +105,7 @@ jobs: echo /opt/llvm-mingw/bin >> $GITHUB_PATH - uses: actions/checkout@v4 with: - ref: ${{ (inputs.commit != '' && inputs.commit) || inputs.branch }} + ref: ${{inputs.ref}} - name: Build env: LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}} @@ -164,7 +159,7 @@ jobs: echo /llvm-mingw/bin >> $GITHUB_PATH - uses: actions/checkout@v4 with: - ref: ${{ (inputs.commit != '' && inputs.commit) || inputs.branch }} + ref: ${{inputs.ref}} - name: Run tests run: | ./run-tests.sh /llvm-mingw diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 87dda4e..27ef25e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,11 +2,8 @@ name: Make a release, upload artifacts on: workflow_dispatch: inputs: - commit: - description: 'Commit to extract from' - type: string - branch: - description: 'Branch to extract from' + ref: + description: 'Ref to extract from' type: string default: 'master' tag: @@ -39,12 +36,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Download artifacts - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v10 with: workflow: build.yml workflow_conclusion: success - commit: ${{inputs.commit}} - branch: ${{inputs.commit == '' && inputs.branch || ''}} + ref: ${{inputs.ref}} event: push - name: Rearrange files run: | @@ -56,7 +52,7 @@ jobs: cat parameters/parameters.txt >> $GITHUB_ENV - uses: actions/checkout@v4 with: - ref: ${{ (inputs.commit != '' && inputs.commit) || inputs.branch }} + ref: ${{inputs.ref}} path: repo - name: Make a tag if: ${{inputs.make_tag}} diff --git a/.github/workflows/test-libcxx.yml b/.github/workflows/test-libcxx.yml index 9371d40..987b18d 100644 --- a/.github/workflows/test-libcxx.yml +++ b/.github/workflows/test-libcxx.yml @@ -2,11 +2,8 @@ name: Run libcxx/libcxxabi/libunwind tests on: workflow_dispatch: inputs: - commit: - description: 'Commit to extract from' - type: string - branch: - description: 'Branch to extract from' + ref: + description: 'Ref to extract from' type: string default: 'master' pipeline_type: @@ -28,12 +25,11 @@ jobs: LLVM_VERSION: ${{steps.get-parameters.outputs.LLVM_VERSION}} steps: - name: Download build parameters - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v10 with: workflow: build.yml workflow_conclusion: success - commit: ${{github.event_name != 'schedule' && inputs.commit || ''}} - branch: ${{github.event_name == 'schedule' && 'master' || (inputs.commit == '' && inputs.branch || '')}} + ref: ${{github.event_name == 'schedule' && 'master' || inputs.ref}} event: ${{github.event_name == 'schedule' && 'schedule' || inputs.pipeline_type}} name: parameters - name: Get build parameters @@ -59,12 +55,11 @@ jobs: run: | choco install ninja - name: Download toolchain - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v10 with: workflow: build.yml workflow_conclusion: success - commit: ${{github.event_name != 'schedule' && inputs.commit || ''}} - branch: ${{github.event_name == 'schedule' && 'master' || (inputs.commit == '' && inputs.branch || '')}} + ref: ${{github.event_name == 'schedule' && 'master' || inputs.ref}} event: ${{github.event_name == 'schedule' && 'schedule' || inputs.pipeline_type}} name: windows-ucrt-${{matrix.arch}}-toolchain - name: Unpack toolchain diff --git a/.github/workflows/test-llvm.yml b/.github/workflows/test-llvm.yml index fecc12f..ad0f0bb 100644 --- a/.github/workflows/test-llvm.yml +++ b/.github/workflows/test-llvm.yml @@ -2,11 +2,8 @@ name: Run LLVM tests on: workflow_dispatch: inputs: - commit: - description: 'Commit to extract from' - type: string - branch: - description: 'Branch to extract from' + ref: + description: 'Ref to extract from' type: string default: 'master' pipeline_type: @@ -28,12 +25,11 @@ jobs: LLVM_VERSION: ${{steps.get-parameters.outputs.LLVM_VERSION}} steps: - name: Download build parameters - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v10 with: workflow: build.yml workflow_conclusion: success - commit: ${{github.event_name != 'schedule' && inputs.commit || ''}} - branch: ${{github.event_name == 'schedule' && 'master' || (inputs.commit == '' && inputs.branch || '')}} + ref: ${{github.event_name == 'schedule' && 'master' || inputs.ref}} event: ${{github.event_name == 'schedule' && 'schedule' || inputs.pipeline_type}} name: parameters - name: Get build parameters @@ -57,12 +53,11 @@ jobs: run: | choco install ninja - name: Download toolchain - uses: dawidd6/action-download-artifact@v6 + uses: dawidd6/action-download-artifact@v10 with: workflow: build.yml workflow_conclusion: success - commit: ${{github.event_name != 'schedule' && inputs.commit || ''}} - branch: ${{github.event_name == 'schedule' && 'master' || (inputs.commit == '' && inputs.branch || '')}} + ref: ${{github.event_name == 'schedule' && 'master' || inputs.ref}} event: ${{github.event_name == 'schedule' && 'schedule' || inputs.pipeline_type}} name: windows-ucrt-${{matrix.arch}}-toolchain - name: Unpack toolchain