Skip to content

Commit cd725b1

Browse files
committed
ci(release): workaround unavailable context var
1 parent e7281a4 commit cd725b1

2 files changed

Lines changed: 17 additions & 19 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
12
name: Release
23

34
on:
@@ -24,10 +25,7 @@ jobs:
2425
uses: ./.github/workflows/build.yml
2526

2627
sync:
27-
if: ${{ fromJSON(env.ACTIVE_VERSIONS)[github.ref] != null }}
28+
if: ${{ github.ref != 'refs/heads/main' }}
2829
uses: ./.github/workflows/sync_branches.yml
29-
with:
30-
from: ${{ github.ref }}
31-
to: ${{ fromJSON(env.ACTIVE_VERSIONS)[github.ref] }}
3230
secrets:
3331
pat_token: ${{ secrets.MIXXX_BRANCH_SYNC_PAT }}

.github/workflows/sync_branches.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22
name: Sync Branches
33
on:
44
workflow_call:
5-
inputs:
6-
from:
7-
description: "The prior release from which to sync"
8-
required: true
9-
type: string
10-
to:
11-
description: "The active release in which to sync"
12-
required: true
13-
type: string
145
secrets:
156
# PAT setup with content:write and pull_request:write
167
pat_token:
@@ -21,12 +12,21 @@ permissions: {}
2112
env:
2213
SYNC_COMMITTER_EMAIL: bot@mixxx.org
2314
SYNC_COMMITTER_NAME: Mixxx Bot
15+
16+
# This variable stores the map of Mixxx branches that still being developed. The key is the branch receiving support and the value is the next version in line
17+
# NOTE: this must be valid JSON!
18+
ACTIVE_VERSIONS: |-
19+
{"2.5": "2.6", "2.6": "main"}
20+
2421
jobs:
2522
sync-branches:
2623
runs-on: ubuntu-latest
2724
permissions:
2825
contents: write
2926
pull-requests: write
27+
env:
28+
FROM: ${{ github.ref }}
29+
TO: ${{ fromJSON(env.ACTIVE_VERSIONS)[github.ref] }}
3030
steps:
3131
# Using an app is the recommended way to allow recursive operations.
3232
# Apps offer a way to have reduced scoped permissions (like GITHUB_TOKEN)
@@ -69,7 +69,7 @@ jobs:
6969
echo "Branch ${SYNC_BRANCH} does not exist yet."
7070
fi
7171
env:
72-
SYNC_BRANCH: sync-branch-${{ inputs.from}}-to-${{ inputs.to }}
72+
SYNC_BRANCH: sync-branch-${{ env.FROM }}-to-${{ env.TO }}
7373

7474
- name: "Merge Changes"
7575
run: |
@@ -99,10 +99,10 @@ jobs:
9999
fi
100100
env:
101101
BRANCH_EXISTS: ${{ steps.check_sync.outputs.branch_exists }}
102-
FROM_BRANCH: ${{ inputs.from}}
103-
TO_BRANCH: ${{ inputs.to }}
104-
SYNC_BRANCH: sync-branch-${{ inputs.from}}-to-${{ inputs.to }}
102+
FROM_BRANCH: ${{ env.FROM }}
103+
TO_BRANCH: ${{ env.TO }}
104+
SYNC_BRANCH: sync-branch-${{ env.FROM }}-to-${{ env.TO }}
105105
GITHUB_TOKEN: ${{ secrets.pat_token }}
106-
PULL_REQUEST_TITLE: Merge changes from `${{ inputs.from }}` into `${{ inputs.to }}`
106+
PULL_REQUEST_TITLE: Merge changes from `${{ env.FROM }}` into `${{ env.TO }}`
107107
PULL_REQUEST_BODY: |
108-
New content has landed in the `${{ inputs.from }}` branch, so let's merge the changes into `${{ inputs.to }}`
108+
New content has landed in the `${{ env.FROM }}` branch, so let's merge the changes into `${{ env.TO }}`

0 commit comments

Comments
 (0)