-
Notifications
You must be signed in to change notification settings - Fork 150
80 lines (70 loc) · 2.72 KB
/
update_licenses.yaml
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Workflow to update licenses for x86 Linux and MacOS
# Support ARM MacOS
# FIXME: https://github.com/zama-ai/concrete-ml-internal/issues/3925
name: Update licenses
on:
workflow_dispatch:
concurrency:
group: "${{ github.ref }}-${{ github.event_name }}-${{ github.workflow }}"
cancel-in-progress: false
jobs:
update_licenses:
strategy:
matrix:
# No arm-macos machines on github runners
# we would need to use one of our own runners
os: [ubuntu-20.04, macos-latest-xl]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env:
PIP_INDEX_URL: ${{ secrets.PIP_INDEX_URL }}
PIP_EXTRA_INDEX_URL: ${{ secrets.PIP_EXTRA_INDEX_URL }}
steps:
# Mask internal URLs if logged
- name: Add masks
id: masks
run: |
echo "::add-mask::${{ secrets.INTERNAL_PYPI_URL_FOR_MASK }}"
echo "::add-mask::${{ secrets.INTERNAL_REPO_URL_FOR_MASK }}"
# Checkout repository
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
token: ${{ secrets.BOT_TOKEN }}
- name: Set up Python 3.8
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry==1.7.1
make setup_env
- name: Update licenses
run: |
make licenses
# Pull the latest changes if there are some
- name: Pull latest changes
run: |
git pull -X theirs
# If the target branch is main or a release branch, a pull request is opened for everyone to
# review
- name: Open PR
if: ${{ github.ref_name == 'main' || startsWith(github.ref_name , 'release/') }}
uses: peter-evans/create-pull-request@b1ddad2c994a25fbc81a28b3ec0e368bb2021c50
with:
token: ${{ secrets.BOT_TOKEN }}
commit-message: "chore: update licenses ${{ matrix.os }}"
branch: "chore/update_licenses_${{ matrix.os }}"
base: "${{ github.ref_name }}"
title: "Update licenses for ${{ matrix.os }} on ${{ github.ref_name }}"
body: "Update licenses for ${{ matrix.os }} on ${{ github.ref_name }}"
# If the target branch is another branch, the current branch is automatically merged into it
- name: Push changes into the current branch
if: ${{ github.ref_name != 'main' && !(startsWith(github.ref_name , 'release/')) }}
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: update licenses for ${{ matrix.os }}"
add_options: '-u'