File: update-cli11.yaml

package info (click to toggle)
mlpack 4.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 31,272 kB
  • sloc: cpp: 226,039; python: 1,934; sh: 1,198; lisp: 414; makefile: 85
file content (51 lines) | stat: -rw-r--r-- 2,475 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Update CLI11
on:
  workflow_dispatch:
  schedule:
    - cron: "0 10 1/16 * *"
permissions:
  contents: read

jobs:
  updateCLI11:
    permissions:
      contents: write # for peter-evans/create-pull-request to create branch
      pull-requests: write # for peter-evans/create-pull-request to create a PR
    if: ${{ github.repository == 'mlpack/mlpack' }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Get Latest CLI11 Tagged Release
        id: cli11-header
        run: |
          # Ping version information upstream.
          CLI11_RELEASE_JSON=$(curl -sL https://api.github.com/repos/CLIUtils/CLI11/releases/latest)
          CLI11_RELEASE_VERSION=$(jq -r ".tag_name" <<< "$CLI11_RELEASE_JSON" | tr -d v)
          echo "release_tag=$(echo $CLI11_RELEASE_VERSION)" >> $GITHUB_OUTPUT
          # Extract out version information from git repository.
          CLI11_VERSION_VALUE=$(grep -i ".*#define CLI11_VERSION.*" src/mlpack/bindings/cli/third_party/CLI/CLI11.hpp | grep -Po "(\d+\.)+\d+")
          # Set the current release tag.
          echo "current_tag=$(echo $CLI11_VERSION_VALUE)" >> $GITHUB_OUTPUT

      - name: Update CLI11
        if: steps.cli11-header.outputs.current_tag != steps.cli11-header.outputs.release_tag
        env:
          CURRENT_TAG: ${{ steps.cli11-header.outputs.current_tag }}
          RELEASE_TAG: ${{ steps.cli11-header.outputs.release_tag }}
        run: |
          # Delete the CLI11.hpp.
          rm -f src/mlpack/bindings/cli/third_party/CLI/CLI11.hpp
          # Download the release.
          curl -sL https://github.com/CLIUtils/CLI11/releases/latest/download/CLI11.hpp -o src/mlpack/bindings/cli/third_party/CLI/CLI11.hpp

      - name: Create Pull Request For CLI11
        if: steps.cli11-header.outputs.current_tag != steps.cli11-header.outputs.release_tag
        uses: peter-evans/create-pull-request@v3
        with:
          commit-message: Upgrade CLI11 to ${{ steps.cli11-header.outputs.release_tag }}
          title: Upgrade CLI11 to ${{ steps.cli11-header.outputs.release_tag }}
          body: |
            Updates [CLIUtils/CLI11](https://github.com/CLIUtils/CLI11) to ${{ steps.cli11-header.outputs.release_tag }}.
            Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request).
          labels: update dependencies, automated PR
          branch: cli11-header-updates-${{ steps.cli11-header.outputs.release_tag }}