From c51e263a36daf6e86d5283331d898f7a5971535a Mon Sep 17 00:00:00 2001 From: Leorize Date: Fri, 5 Jul 2024 11:34:57 -0500 Subject: [PATCH] in progress: release new --- .github/workflows/ci.yml | 30 ++++++++++----------- .github/workflows/leak.yml | 11 ++++++++ .github/workflows/publisher.yml | 42 +++++++++++++++++++++++------- .github/workflows/reproducible.yml | 11 ++++++++ 4 files changed, 70 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a75e1a04e9..b2b20e24f2e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,12 +27,26 @@ on: merge_group: # Test all additions to merge queue + workflow_call: + # Allow the workflow to be reused elsewhere + # Run every script actions in bash defaults: run: shell: bash jobs: + cancel: + if: github.event == 'merge_group' || github.event == 'pull_request' + name: Cancel previous runs (Merge Queue/PR) + runs-on: ubuntu-latest + + permissions: + actions: write + + steps: + - uses: pierreraffa/cancel-previous-runs-action@1.11 + pre_run: name: Provide additional context for the workflow runs-on: ubuntu-latest @@ -42,24 +56,10 @@ jobs: shared_builder: ${{ steps.matrix.outputs.shared }} steps: - - id: run_cond - uses: fkirc/skip-duplicate-actions@v5.3.1 - with: - # Cancel CI on outdated commits - cancel_others: true - # Don't skip when a duplicated run (ie. from a PR) is done. - # - # Only CI in upstream has docs publishing rights. - skip_after_successful_duplicate: false - # Do not skip on push, dispatched or cron - do_not_skip: '["push", "workflow_dispatch", "schedule"]' - - id: skip_result name: Whether to skip checks run: | - if [[ '${{ steps.run_cond.outputs.should_skip }}' == true ]]; then - echo "result=true" >> $GITHUB_OUTPUT - elif [[ '${{ github.event.pull_request.draft }}' == true ]]; then + if [[ '${{ github.event.pull_request.draft }}' == true ]]; then echo "Pull request is in draft state, skipping" echo "result=true" >> $GITHUB_OUTPUT else diff --git a/.github/workflows/leak.yml b/.github/workflows/leak.yml index 753c6af9458..fe21a0a67eb 100644 --- a/.github/workflows/leak.yml +++ b/.github/workflows/leak.yml @@ -6,6 +6,17 @@ on: merge_group: jobs: + cancel: + if: github.event == 'merge_group' + name: Cancel previous runs (Merge Queue) + runs-on: ubuntu-latest + + permissions: + actions: write + + steps: + - uses: pierreraffa/cancel-previous-runs-action@1.11 + leaktest: # Skip this for PRs if: github.event_name != 'pull_request' diff --git a/.github/workflows/publisher.yml b/.github/workflows/publisher.yml index 5d0125ed76a..a60e56d4aef 100644 --- a/.github/workflows/publisher.yml +++ b/.github/workflows/publisher.yml @@ -4,6 +4,14 @@ on: branches: - devel + workflow_call: + inputs: + run_id: + required: false + type: string + description: The run ID with artifacts to be published + default: ${{ github.run_id }} + # Run every script actions in bash defaults: run: @@ -28,13 +36,20 @@ jobs: - name: Obtain latest successful run id id: finder run: | - run_id=$(gh run list \ - -c "$COMMIT" \ - -w "$WORKFLOW" \ - -s "$CONCLUSION" \ - --limit 1 \ - --json databaseId \ - --jq '.[].databaseId') + run_id= + if [[ -n $INPUT_RUNID ]]; then + echo "Using input run id" + run_id=$INPUT_RUNID + else + echo "Querying latest run id for $COMMIT" + run_id=$(gh run list \ + -c "$COMMIT" \ + -w "$WORKFLOW" \ + -s "$CONCLUSION" \ + --limit 1 \ + --json databaseId \ + --jq '.[].databaseId') + fi if [[ -z $run_id ]]; then echo "::error::Could not find any CI run for commit $COMMIT" exit 1 @@ -46,6 +61,7 @@ jobs: CONCLUSION: success GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} + INPUT_RUNID: ${{ inputs.run_id }} # Download the latest instance of artifacts from a build done previously - name: Download generated source archive @@ -91,14 +107,22 @@ jobs: $toUpload $delimiter EOF - echo "version=$(./release_manifest version)" >> $GITHUB_OUTPUT + version=$(./release_manifest version) + prerelease=true + [[ $version == *-* ]] || prerelease=false + echo "version=$version" >> $GITHUB_OUTPUT + echo "prerelease=$prerelease" >> $GITHUB_OUTPUT working-directory: release-staging + - id: release-desc + name: Create release description + run: | + - id: release name: Create pre-release uses: softprops/action-gh-release@v2.0.6 with: - prerelease: true + prerelease: ${{ steps.release-files.outputs.prerelease }} files: ${{ steps.release-files.outputs.result }} tag_name: ${{ steps.release-files.outputs.version }} fail_on_unmatched_files: true diff --git a/.github/workflows/reproducible.yml b/.github/workflows/reproducible.yml index 12a0ea31bb3..e0d5595f7cc 100644 --- a/.github/workflows/reproducible.yml +++ b/.github/workflows/reproducible.yml @@ -12,6 +12,17 @@ on: merge_group: jobs: + cancel: + if: github.event == 'merge_group' + name: Cancel previous runs (Merge Queue) + runs-on: ubuntu-latest + + permissions: + actions: write + + steps: + - uses: pierreraffa/cancel-previous-runs-action@1.11 + reprotest: # This job is meant for testing whether the compiler can be built # reproducibly given the same build environment.