Update the dependencies version #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow | |
| name: Update the dependencies version | |
| on: | |
| workflow_dispatch: | |
| permissions: {} | |
| env: | |
| SYNC_COMMITTER_EMAIL: bot@mixxx.org | |
| SYNC_COMMITTER_NAME: Mixxx Bot | |
| jobs: | |
| update-vcpkg: | |
| strategy: | |
| fail-fast: false | |
| # 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 | |
| matrix: | |
| include: | |
| - ref: 2.5 | |
| channel: 2.5 | |
| - ref: 2.6 | |
| channel: 2.6 | |
| - ref: main | |
| channel: 2.7 | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| env: | |
| SYNC_BRANCH: update-vcpkg-for-${{ matrix.ref }} | |
| BRANCH: ${{ matrix.ref }}} | |
| steps: | |
| # Using an app is the recommended way to allow recursive operations. | |
| # Apps offer a way to have reduced scoped permissions (like GITHUB_TOKEN) | |
| # and short lifespan, unlike PAT. | |
| # As we are trialing this approach tho, it is fine to play with a PAT and not spend the | |
| # extra time setting up an app | |
| # | |
| # - name: Generate App Token | |
| # id: generate-token-key-pair | |
| # uses: actions/create-github-app-token@v1 | |
| # with: | |
| # private-key: ${{ secrets.MIXXX_BOT_APP_PRIVATE_KEY }} | |
| # app-id: ${{ vars.MIXXX_BOT_APP_ID }} | |
| - name: "Check out repository" | |
| uses: actions/checkout@v6 | |
| with: | |
| token: ${{ secrets.MIXXX_BRANCH_SYNC_PAT }} | |
| fetch-depth: 0 | |
| ref: ${{ matrix.ref }} | |
| persist-credentials: true | |
| - name: "Configure Git" | |
| run: | | |
| git config --global merge.ours.driver true | |
| git config --global pull.rebase false | |
| - name: "Check if merge branch already exists" | |
| id: check_sync | |
| run: | | |
| if git fetch origin "${SYNC_BRANCH}"; then | |
| echo "Branch ${SYNC_BRANCH} already exists, checking if the branch was modified..." | |
| echo "branch_exists=true" >> $GITHUB_OUTPUT | |
| COMMITTER_EMAIL="$(git show --pretty=format:"%ce" --no-patch "origin/${SYNC_BRANCH}")" | |
| if [ "${COMMITTER_EMAIL}" = "${SYNC_COMMITTER_EMAIL}" ]; then | |
| echo "Branch ${SYNC_BRANCH} was NOT modified." | |
| else | |
| echo "Branch ${SYNC_BRANCH} was modified." | |
| fi | |
| else | |
| echo "Branch ${SYNC_BRANCH} does not exist yet." | |
| fi | |
| - name: "Fetch the latest version of the dependencies package version" | |
| run: | | |
| set -x | |
| if [ ! "${{ matrix.ref }}" = "main" ]; then | |
| echo "::group::Get the latest VCPKG update script" | |
| git fetch origin main | |
| git checkout origin/main -- tools/update_vcpkg.py | |
| git reset tools/update_vcpkg.py | |
| echo "::endgroup::" | |
| fi | |
| echo "::group::Fetching and updating VCPKG" | |
| if [ "${BRANCH_EXISTS}" = true ]; then | |
| git checkout "${SYNC_BRANCH}" | |
| git pull | |
| else | |
| git checkout -b "${SYNC_BRANCH}" | |
| fi | |
| git config --global user.email "${SYNC_COMMITTER_EMAIL}" | |
| git config --global user.name "${SYNC_COMMITTER_NAME}" | |
| python3 tools/update_vcpkg.py ${{ matrix.channel }} | |
| git status | |
| echo "::endgroup::" | |
| git add tools/*_buildenv.* | |
| if ! git commit -m "chore: update to latest VCPKG distribution"; then | |
| echo "No changes detected!" | |
| exit 0 | |
| fi | |
| git push origin "${SYNC_BRANCH}" | |
| if [ ! "${BRANCH_EXISTS}" = true ]; then | |
| gh pr create -B "${{ matrix.ref }}" -H "${SYNC_BRANCH}" --title "${PULL_REQUEST_TITLE}" --body "${PULL_REQUEST_BODY}" | |
| gh pr edit --add-label "sync-branches" | |
| fi | |
| env: | |
| BRANCH_EXISTS: ${{ steps.check_sync.outputs.branch_exists }} | |
| GITHUB_TOKEN: ${{ secrets.MIXXX_BRANCH_SYNC_PAT }} | |
| PULL_REQUEST_TITLE: Update VCPKG dependencies for `${{ matrix.ref }}` | |
| PULL_REQUEST_BODY: | | |
| New VCPKG archive is available on channel `${{ matrix.channel }}`, so let's merge the changes into `${{ matrix.ref }}` |