Skip to content

Commit

Permalink
chore: allow to pick which licenses to run
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanBredehoft committed Apr 5, 2024
1 parent 6d7f3e6 commit b54e5d7
Showing 1 changed file with 45 additions and 10 deletions.
55 changes: 45 additions & 10 deletions .github/workflows/update_licenses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,57 @@
name: Update licenses
on:
workflow_dispatch:
inputs:
linux:
description: "Update licenses for Ubuntu"
type: boolean
required: false
default: true
mac_silicon:
description: "Update licenses for macOS (silicon)"
type: boolean
required: false
default: true
mac_intel:
description: "Update licenses for macOS (intel)"
type: boolean
required: false
default: true

concurrency:
group: "${{ github.ref }}-${{ github.event_name }}-${{ github.workflow }}"
cancel-in-progress: true


jobs:
build-os-matrix:
runs-on: [ubuntu-latest]
outputs:
os-matrix: ${{ steps.build-os-matrix.outputs.os-matrix }}
steps:
- name: Build OS matrix
id: build-os-matrix
run: |
os_matrix=()
if ${{ inputs.linux }} ; then
os_matrix+=( "{\"os_name\": \"linux\", \"os\": \"ubuntu-latest\"}" )
fi
if ${{ inputs.mac_silicon }} ; then
os_matrix+=( "{\"os_name\": \"mac_silicon\", \"os\": \"macos-latest-xlarge\"}" )
fi
if ${{ inputs.mac_intel }} ; then
os_matrix+=( "{\"os_name\": \"mac_intel\", \"os\": \"macos-latest-large\"}" )
fi
echo "os-matrix=${os_matrix}" >> $GITHUB_OUTPUT
# Update licenses for all supported OS
update_licenses:
needs: [build-os-matrix]
strategy:
matrix:
config:
- {os_name: linux, os: ubuntu-20.04}
- {os_name: mac_intel, os: macos-latest-large}
- {os_name: mac_silicon, os: macos-latest-xlarge}

runs-on: ${{ matrix.config.os }}
matrix: ${{ fromJSON(format(needs.build-os-matrix.outputs.os-matrix)) }}

runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
Expand Down Expand Up @@ -56,11 +91,11 @@ jobs:
# Upload the updated license files as artifacts, if they exist
- uses: actions/upload-artifact@v4
with:
name: licenses-${{ matrix.config.os_name }}
name: licenses-${{ matrix.os_name }}
if-no-files-found: ignore
path: |
deps_licenses/licenses_${{ matrix.config.os_name }}_user.txt
deps_licenses/licenses_${{ matrix.config.os_name }}_user.txt.md5
deps_licenses/licenses_${{ matrix.os_name }}_user.txt
deps_licenses/licenses_${{ matrix.os_name }}_user.txt.md5
# Push the updates license files, as a PR or directly to the branch
push_licenses:
Expand Down

0 comments on commit b54e5d7

Please sign in to comment.