|
| 1 | +name: Prepare release |
| 2 | +on: |
| 3 | + workflow_call: |
| 4 | + outputs: |
| 5 | + version: |
| 6 | + description: "The version that is being released." |
| 7 | + value: ${{ jobs.prepare.outputs.version }} |
| 8 | + major_version: |
| 9 | + description: "The major version of the release." |
| 10 | + value: ${{ jobs.prepare.outputs.major_version }} |
| 11 | + latest_tag: |
| 12 | + description: "The most recent, existing release tag." |
| 13 | + value: ${{ jobs.prepare.outputs.latest_tag }} |
| 14 | + backport_source_branch: |
| 15 | + description: "The release branch for the given tag." |
| 16 | + value: ${{ jobs.prepare.outputs.backport_source_branch }} |
| 17 | + backport_target_branches: |
| 18 | + description: "JSON encoded list of branches to target with backports." |
| 19 | + value: ${{ jobs.prepare.outputs.backport_target_branches }} |
| 20 | + |
| 21 | + push: |
| 22 | + paths: |
| 23 | + - .github/workflows/prepare-release.yml |
| 24 | + |
| 25 | +jobs: |
| 26 | + prepare: |
| 27 | + name: "Prepare release" |
| 28 | + runs-on: ubuntu-latest |
| 29 | + if: github.repository == 'github/codeql-action' |
| 30 | + |
| 31 | + permissions: |
| 32 | + contents: read |
| 33 | + |
| 34 | + outputs: |
| 35 | + version: ${{ steps.versions.outputs.version }} |
| 36 | + major_version: ${{ steps.versions.outputs.major_version }} |
| 37 | + latest_tag: ${{ steps.versions.outputs.latest_tag }} |
| 38 | + backport_source_branch: ${{ steps.branches.outputs.backport_source_branch }} |
| 39 | + backport_target_branches: ${{ steps.branches.outputs.backport_target_branches }} |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Checkout repository |
| 43 | + uses: actions/checkout@v5 |
| 44 | + with: |
| 45 | + fetch-depth: 0 # Need full history for calculation of diffs |
| 46 | + |
| 47 | + - name: Configure runner for release |
| 48 | + uses: ./.github/actions/release-initialise |
| 49 | + |
| 50 | + - name: Get version tags |
| 51 | + id: versions |
| 52 | + run: | |
| 53 | + VERSION="v$(jq '.version' -r 'package.json')" |
| 54 | + echo "version=${VERSION}" >> $GITHUB_OUTPUT |
| 55 | + MAJOR_VERSION=$(cut -d '.' -f1 <<< "${VERSION}") |
| 56 | + echo "major_version=${MAJOR_VERSION}" >> $GITHUB_OUTPUT |
| 57 | + LATEST_TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | head -1) |
| 58 | + echo "latest_tag=${LATEST_TAG}" >> $GITHUB_OUTPUT |
| 59 | +
|
| 60 | + - name: Determine older release branches |
| 61 | + id: branches |
| 62 | + uses: ./.github/actions/release-branches |
| 63 | + with: |
| 64 | + major_version: ${{ steps.versions.outputs.major_version }} |
| 65 | + latest_tag: ${{ steps.versions.outputs.latest_tag }} |
| 66 | + |
| 67 | + - name: Print release information |
| 68 | + run: | |
| 69 | + echo 'version: ${{ steps.versions.outputs.version }}' |
| 70 | + echo 'major_version: ${{ steps.versions.outputs.major_version }}' |
| 71 | + echo 'latest_tag: ${{ steps.versions.outputs.latest_tag }}' |
| 72 | + echo 'backport_source_branch: ${{ steps.branches.outputs.backport_source_branch }}' |
| 73 | + echo 'backport_target_branches: ${{ steps.branches.outputs.backport_target_branches }}' |
0 commit comments