|
35 | 35 | if: failure()
|
36 | 36 | with:
|
37 | 37 | commit_message: 'ci: auto fixes from pre-commit'
|
| 38 | + |
| 39 | + format_and_update_ports: |
| 40 | + runs-on: ubuntu-latest |
| 41 | + permissions: |
| 42 | + contents: write |
| 43 | + |
| 44 | + steps: |
| 45 | + - name: Checkout repository |
| 46 | + uses: actions/checkout@v4 |
| 47 | + with: |
| 48 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 49 | + ref: ${{ github.head_ref }} |
| 50 | + fetch-depth: 2 |
| 51 | + |
| 52 | + - name: Setup vcpkg |
| 53 | + uses: ./.github/actions/setup-vcpkg |
| 54 | + with: |
| 55 | + vcpkgVersion: latest |
| 56 | + vcpkgRoot: /usr/local/vcpkg |
| 57 | + vcpkgDownload: /usr/local/vcpkg-downloads |
| 58 | + |
| 59 | + - name: Format vcpkg.json |
| 60 | + run: | |
| 61 | + vcpkg format-manifest --all $(find . -name "vcpkg.json") |
| 62 | +
|
| 63 | + - name: Commit format vcpkg.json |
| 64 | + uses: stefanzweifel/git-auto-commit-action@v5 |
| 65 | + if: success() |
| 66 | + with: |
| 67 | + commit_message: 'ci: format vcpkg configuration' |
| 68 | + file_pattern: vcpkg.json |
| 69 | + |
| 70 | + - name: Exit 1 if vcpkg configuration changes have been detected |
| 71 | + if: steps.auto-commit-action.outputs.changes_detected == 'true' |
| 72 | + run: | |
| 73 | + exit 1 |
| 74 | +
|
| 75 | + - name: Install all modules |
| 76 | + run: | |
| 77 | + for dir in ports/* ; do |
| 78 | + echo "Test to install $dir" |
| 79 | + vcpkg install ${dir##ports/} --overlay-ports=ports |
| 80 | + done |
| 81 | +
|
| 82 | + - name: Detect ports changes |
| 83 | + id: filter-ports |
| 84 | + uses: dorny/paths-filter@v2 |
| 85 | + with: |
| 86 | + list-files: shell |
| 87 | + filters: | |
| 88 | + ports: |
| 89 | + - ports/** |
| 90 | +
|
| 91 | + - name: Update versions |
| 92 | + if: steps.filter-ports.outputs.ports == 'true' |
| 93 | + run: | |
| 94 | + for dir in ports/* ; do |
| 95 | + vcpkg x-add-version ${dir##ports/} --overlay-ports=./ports \ |
| 96 | + --x-builtin-registry-versions-dir=./versions/ \ |
| 97 | + --x-builtin-ports-root=./ports |
| 98 | + done |
| 99 | +
|
| 100 | + - name: Detect versions changes |
| 101 | + if: steps.filter-ports.outputs.ports == 'true' |
| 102 | + id: filter-versions |
| 103 | + uses: dorny/paths-filter@v2 |
| 104 | + with: |
| 105 | + list-files: shell |
| 106 | + base: HEAD |
| 107 | + filters: | |
| 108 | + versions: |
| 109 | + - versions/** |
| 110 | +
|
| 111 | + - name: Get last commit message |
| 112 | + if: steps.filter-ports.outputs.versions == 'true' |
| 113 | + id: last-commit-message |
| 114 | + run: | |
| 115 | + echo "msg=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT |
| 116 | +
|
| 117 | + - name: Commit versions |
| 118 | + if: steps.filter-versions.outputs.versions == 'true' |
| 119 | + uses: stefanzweifel/git-auto-commit-action@v5 |
| 120 | + with: |
| 121 | + file_pattern: versions/* |
| 122 | + commit_message: ${{ steps.last-commit-message.outputs.msg }} |
| 123 | + push_options: --force |
| 124 | + commit_options: --amend --no-edit |
| 125 | + skip_fetch: true |
0 commit comments