|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - qca-qt5 |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + format_and_update_ports: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + permissions: |
| 16 | + contents: write |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 23 | + ref: ${{ github.head_ref }} |
| 24 | + fetch-depth: 2 |
| 25 | + |
| 26 | + - name: Setup vcpkg |
| 27 | + uses: ./.github/actions/setup-vcpkg |
| 28 | + with: |
| 29 | + vcpkgVersion: latest |
| 30 | + vcpkgRoot: /usr/local/vcpkg |
| 31 | + vcpkgDownload: /usr/local/vcpkg-downloads |
| 32 | + |
| 33 | + - name: Format vcpkg.json |
| 34 | + run: | |
| 35 | + vcpkg format-manifest --all $(find . -name "vcpkg.json") |
| 36 | +
|
| 37 | + - name: Commit format vcpkg.json |
| 38 | + uses: stefanzweifel/git-auto-commit-action@v5 |
| 39 | + if: success() |
| 40 | + with: |
| 41 | + commit_message: 'ci: format vcpkg configuration' |
| 42 | + file_pattern: vcpkg.json |
| 43 | + |
| 44 | + - name: Exit 1 if vcpkg configuration changes have been detected |
| 45 | + if: steps.auto-commit-action.outputs.changes_detected == 'true' |
| 46 | + run: | |
| 47 | + exit 1 |
| 48 | +
|
| 49 | + - name: Detect ports changes against default branch |
| 50 | + id: filter-ports |
| 51 | + uses: dorny/paths-filter@v2 |
| 52 | + with: |
| 53 | + list-files: shell |
| 54 | + filters: | |
| 55 | + ports: |
| 56 | + - ports/** |
| 57 | +
|
| 58 | + - name: Update versions |
| 59 | + if: steps.filter-ports.outputs.ports == 'true' |
| 60 | + run: | |
| 61 | + for dir in ports/* ; do |
| 62 | + vcpkg x-add-version ${dir##ports/} --overlay-ports=./ports \ |
| 63 | + --x-builtin-registry-versions-dir=./versions/ \ |
| 64 | + --x-builtin-ports-root=./ports |
| 65 | + done |
| 66 | +
|
| 67 | + - name: Detect versions changes against local |
| 68 | + if: steps.filter-ports.outputs.ports == 'true' |
| 69 | + id: filter-versions |
| 70 | + uses: dorny/paths-filter@v2 |
| 71 | + with: |
| 72 | + list-files: shell |
| 73 | + base: HEAD |
| 74 | + filters: | |
| 75 | + versions: |
| 76 | + - versions/** |
| 77 | +
|
| 78 | + - name: Get last commit message |
| 79 | + if: steps.filter-versions.outputs.versions == 'true' |
| 80 | + id: last-commit-message |
| 81 | + run: | |
| 82 | + echo "msg=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT |
| 83 | +
|
| 84 | + - name: Commit versions |
| 85 | + if: steps.filter-versions.outputs.versions == 'true' |
| 86 | + uses: stefanzweifel/git-auto-commit-action@v5 |
| 87 | + with: |
| 88 | + file_pattern: versions/* |
| 89 | + commit_message: ${{ steps.last-commit-message.outputs.msg }} |
| 90 | + push_options: --force |
| 91 | + commit_options: --amend --no-edit |
| 92 | + skip_fetch: true |
0 commit comments