-
Notifications
You must be signed in to change notification settings - Fork 7
Shared actions 🔥 #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 99 commits
1ab5158
edbeb4e
a5b8eec
e2b40e5
4b858d0
e335091
afbc460
4426abd
7e82fbb
f274f7e
97bfa3c
635fc1f
10252eb
e74e45d
87c2f51
17b643d
89189bc
1b00df0
020c430
bc3379b
a4dcd45
85552e1
fc2fb42
759957d
4f0458d
9377802
bafd49d
54678ad
23b33bc
35728eb
6e0af6a
365e146
a5bb4ee
fe760b1
aef6aec
d7b398a
ad4598c
f2f6e81
402c407
a0e01cd
8b243f8
4236154
d04b554
3e4c2b8
09dc5b4
0398bb6
8f8a620
15c9576
09f1ce2
503c536
7e70338
10919d9
7af13f1
1f9b505
ea835a2
554ff1b
a487e56
8606df7
5214d25
0a9d56e
e4fd5e4
77e94e1
fcd2593
59003b1
e26a97a
fc5beb6
55ccf22
48f3114
b280d4e
901b2e7
1b54fc8
1d3e1fc
b49f5ee
3706beb
1d0fc89
5f9329d
f7690ba
293a360
9a3de39
1a1832c
06e56e5
8a6e44b
1009b98
f849971
8989922
98dc9c2
fb7c188
174e685
40322a1
c2931b1
1fad698
c8c8e2a
1bb2e77
2f96d1f
68411e6
c0ffefd
a4a17d7
7f36f1b
a745f15
c4a4975
9e0dda9
917788b
cf9d9c3
0a6a87a
cea9f6b
14952a6
ad10552
7ec9b4c
4e5bab5
3e2a51c
a260b12
34104fe
98e778a
5bc95f4
3da2629
7077640
032df84
b16f922
376e9de
d8eee7c
97272d5
c5610c3
07dc45c
26a0579
cc7fc25
8588385
adfe690
811c3a6
80b4363
7238983
582dec9
04aadd9
4423dea
b8ceb2e
97867f5
aa20eac
6f23c15
2785469
8a4e90d
f7da584
36ace76
391e97b
7dea1fb
f74d243
581437e
09cd260
2de9e9e
38664f5
3f48730
a86975b
a6ed4a3
e66d8eb
d6376a2
e68f64e
b9972a5
f83d52e
5a82c89
a739a15
68c76e6
f7cbe83
c2c9476
6338d26
56825bf
84b08bd
6cd6025
ae5c5f5
03132af
e6503f5
0ef4fed
738c636
86e9bb1
f8b1d0d
ecc7214
c6eefbb
a05234d
394d380
87c468d
9f7a617
7331750
395184a
9e5b380
1cb896b
e860e80
e4a72cd
5f5b143
d548019
0c6ff8a
3401b0e
28a88a8
6bc327a
fda3548
cd78e6d
7790f8c
f83377d
5cd569c
af0ed6b
49f37e5
bc86c78
f464ee1
ec460b4
11205e3
b650320
83b95a7
84576d0
48a4407
855792d
7906d0a
a402bba
028efde
fa266e8
89a2801
dd0de49
28a279e
d9c0084
a5aaf2e
708fcc8
9993a5b
81035cb
ef06d3a
957750a
671462f
f2add89
e6996cc
d11cf69
19d73c8
b3e5cc5
a09d566
e3ca54c
240cc7e
cad2ff8
085bfb6
f3f762e
b10cc34
4100827
545dff6
3e6fc21
8cb802f
c4ddf14
10a9919
94ff60c
1642d72
664a0da
6a10d64
9b38c7b
41e522f
e2e51c9
48bfd1f
e220fef
1b3b68c
e57c294
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| name: Auto translate | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| branch: | ||
| description: 'The branch to checkout and run the action in' | ||
| type: string | ||
| default: ${{ github.ref }} | ||
| action_branch: | ||
| description: 'The shared action branch to checkout' | ||
| type: string | ||
| default: main | ||
| python_version: | ||
| description: 'The python version to use' | ||
| type: string | ||
| default: "3.8" | ||
| locale_folder: | ||
| description: 'The base folder to look for localization files' | ||
| type: string | ||
| default: locale | ||
|
|
||
|
|
||
| jobs: | ||
| autotranslate: | ||
| env: | ||
| API_KEY: ${{secrets.DL_API_KEY}} | ||
| LOCALE_FOLDER: ${{ github.workspace }}/action/package/${{ inputs.locale_folder }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ inputs.branch }} | ||
| path: action/package/ | ||
| - name: Checkout Scripts Repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: OpenVoiceOS/.github | ||
| ref: ${{ inputs.action_branch }} | ||
| path: action/github/ | ||
| - name: Setup Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ inputs.python_version }} | ||
| - name: Install Translate Tools | ||
| run: | | ||
| python -m pip install -r action/github/requirements/pip_translation.txt | ||
| - name: Auto Translate | ||
| run: | | ||
| python action/github/scripts/translate.py | ||
| - name: Commit to dev | ||
| uses: stefanzweifel/git-auto-commit-action@v4 | ||
| with: | ||
| commit_message: autotranslate | ||
| repository: action/package/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| name: Check Supported Python Versions | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| schedule: | ||
| - cron: '0 0 * * *' | ||
|
|
||
| jobs: | ||
| update-versions: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Run Python Version Check Script | ||
| run: | ||
| python scripts/check_supported_py_versions.py | ||
| - name: Commit and Push if Changes | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add supported_py_versions.json | ||
| git commit -m "Update Supported Python Versions" || exit 0 # Exit gracefully if no changes | ||
| git push |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| name: License Tests | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| runner: | ||
| description: 'Runner to use' | ||
| type: string | ||
| default: 'ubuntu-latest' | ||
| branch: | ||
| description: 'Branch to check out' | ||
| type: string | ||
| default: ${{ github.ref }} | ||
| action_branch: | ||
| description: 'The shared action branch to checkout' | ||
| type: string | ||
| default: main | ||
| python-version: | ||
| description: 'Python version to use' | ||
| type: string | ||
| default: '3.8' | ||
| system-deps: | ||
| description: 'System dependencies (whitespace delimited) to install instead of sys_deb_common_deps.txt' | ||
| required: false | ||
| type: string | ||
| package-extras: | ||
| description: 'Optional extras to install the python package with' | ||
| required: false | ||
| type: string | ||
| packages-exclude: | ||
| description: 'Regex to exclude packages from the license check' | ||
| type: string | ||
| default: '^(precise-runner|fann2|tqdm|bs4|nvidia|bitstruct).*' | ||
| licenses-exclude: | ||
| description: 'Regex to exclude licenses from the license check' | ||
| type: string | ||
| default: '^(Mozilla).*$' | ||
| jobs: | ||
| license_tests: | ||
| timeout-minutes: 15 | ||
| runs-on: ${{ inputs.runner }} | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ inputs.branch }} | ||
| path: action/package/ | ||
| - name: Checkout Scripts Repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: action/github/ | ||
| ref: ${{ inputs.action_branch }} | ||
| repository: OpenVoiceOS/.github | ||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ inputs.python-version }} | ||
| - name: Install Build Tools | ||
| run: | | ||
| python -m pip install build wheel | ||
| - name: Install System Dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| if [ -z ${{ inputs.system-deps }} ]; then | ||
| xargs sudo apt-get install -y < ${{ github.workspace }}/action/github/requirements/sys_deb_common_deps.txt | ||
| else | ||
| sudo apt-get install ${{ inputs.system-deps }} | ||
| fi | ||
| - name: Install repo | ||
| run: | | ||
| cd ${{ github.workspace }}/action/package | ||
| if [ -z ${{ inputs.package-extras }} ]; then | ||
| pip install . | ||
| else | ||
| pip install .[${{ inputs.package-extras }}] | ||
| fi | ||
| - name: Get explicit and transitive dependencies | ||
| run: | | ||
| pip freeze > requirements-all.txt | ||
| - name: Check licenses | ||
| id: license_check_report | ||
| uses: pilosus/action-pip-license-checker@v2 | ||
| with: | ||
| requirements: 'requirements-all.txt' | ||
| fail: 'Copyleft,Other,Error' | ||
| fails-only: true | ||
| exclude: ${{ inputs.packages-exclude }} | ||
| exclude-license: ${{ inputs.licenses-exclude }} | ||
| - name: Print report | ||
| if: ${{ always() }} | ||
| run: echo "${{ steps.license_check_report.outputs.report }}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| name: Notify Matrix Chat | ||
|
|
||
| # only triggers on pull request closed events | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| pr_id: | ||
| type: number | ||
| required: true | ||
|
|
||
| jobs: | ||
| notify_pr_matrix: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Send message to Matrix bots channel | ||
| id: matrix-chat-message | ||
| uses: fadenb/matrix-chat-message@v0.0.6 | ||
| with: | ||
| homeserver: 'matrix.org' | ||
| token: ${{ secrets.MATRIX_TOKEN }} | ||
| channel: '!WjxEKjjINpyBRPFgxl:krbel.duckdns.org' | ||
| message: | | ||
| new ${{ github.repository }} PR merged! https://github.com/${{ github.repository }}/pull/${{ inputs.pr_id }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| name: Propose SemVer Release | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| branch: | ||
| type: string | ||
| default: dev | ||
| action_branch: | ||
| description: 'The shared action branch to checkout' | ||
| type: string | ||
| default: main | ||
| python_version: | ||
| description: 'The python version to use' | ||
| type: string | ||
| default: "3.8" | ||
| version_file: | ||
| description: 'The file location to read the version from' | ||
| type: string | ||
| default: version.py | ||
| release_type: | ||
| type: string | ||
| description: 'The type of release to make' | ||
| required: true | ||
| changelog_file: | ||
| type: string | ||
| default: CHANGELOG.md | ||
|
|
||
|
|
||
| jobs: | ||
| bump_version: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| VERSION_FILE: ${{ github.workspace }}/action/package/${{ inputs.version_file }} | ||
| TARGET_BRANCH: ${{ inputs.release_type == 'patch' && 'testing' || 'stable' }} | ||
| GITHUB_REPOSITORY: ${{ github.repository }} | ||
| RELEASE_TYPE: ${{ inputs.release_type }} | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ inputs.branch }} | ||
| path: action/package/ | ||
| - name: Checkout Scripts Repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: action/github/ | ||
| ref: ${{ inputs.action_branch }} | ||
| repository: OpenVoiceOS/.github | ||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ inputs.python_version }} | ||
| - name: Install Python Dependencies | ||
| run: | | ||
| pip install -r ${{ github.workspace }}/action/github/requirements/pip_base.txt | ||
|
||
| - name: Set up Git Authentication | ||
| run: | | ||
| cd ${{ github.workspace }}/action/package/ | ||
| git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | ||
| - name: Create Branch (if necessary) | ||
| run: | | ||
| cd ${{ github.workspace }}/action/package/ | ||
| git fetch --unshallow origin ${{ inputs.branch }} | ||
| INITIAL_COMMIT=$(git rev-list --max-parents=0 ${{ inputs.branch }}) | ||
| TARGET_BRANCH_EXISTS=$(git ls-remote --heads origin ${{ env.TARGET_BRANCH }} | wc -l) | ||
| if [ "$TARGET_BRANCH_EXISTS" -eq "0" ]; then | ||
| git checkout $INITIAL_COMMIT | ||
| git checkout -b ${{ env.TARGET_BRANCH }} | ||
| git push origin ${{ env.TARGET_BRANCH }} --force | ||
| git checkout ${{ inputs.branch }} | ||
| fi | ||
| - name: Increment Version | ||
| id: version | ||
| run: | | ||
| python action/github/scripts/bump_${{ inputs.release_type }}.py | ||
| VERSION=$(python action/package/setup.py --version) | ||
| echo "VERSION=${VERSION}" >> $GITHUB_ENV | ||
| - name: Push Version Change | ||
| uses: stefanzweifel/git-auto-commit-action@v4 | ||
| with: | ||
| commit_message: Increment Version to ${{ env.VERSION }} | ||
| repository: action/package/ | ||
| - name: Check Latest Release | ||
| run: | | ||
| SINCE_TAG=$(python action/github/scripts/semver_cycle_start.py) | ||
| echo "SINCE_TAG=${SINCE_TAG}" >> $GITHUB_ENV | ||
| - name: Generate Changelog | ||
| id: changelog | ||
| uses: heinrichreimer/github-changelog-generator-action@v2.3 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| output: action/package/${{ inputs.changelog_file }} | ||
| futureRelease: ${{ env.VERSION }} | ||
| sinceTag: ${{ env.SINCE_TAG }} | ||
| - name: Push Changelog | ||
| uses: stefanzweifel/git-auto-commit-action@v4 | ||
| with: | ||
| commit_message: Update Changelog | ||
| repository: action/package/ | ||
| - name: Checkout Testing Branch | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ env.TARGET_BRANCH }} | ||
| path: action/package/ | ||
| - name: Rebase Latest Changes | ||
| run: | | ||
| cd ${{ github.workspace }}/action/package/ | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git fetch origin ${{ inputs.branch }} | ||
| git rebase FETCH_HEAD | ||
| - name: Create Pull Request to ${{ env.TARGET_BRANCH }} | ||
| uses: peter-evans/create-pull-request@v5 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| path: action/package/ | ||
| commit-message: "Propose ${{ inputs.release_type }} release" | ||
| title: "Propose ${{ inputs.release_type }} release" | ||
| body: | | ||
| This pull request proposes a ${{ env.TARGET_BRANCH }} release of the project. | ||
| Please review the changelog and merge if it looks good. | ||
| branch: staging_${{ inputs.release_type }}_release | ||
| base: ${{ env.TARGET_BRANCH }} | ||
| draft: false | ||
| assignees: ${{ github.actor }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| name: Rebase dev after SemVer bump | ||
|
|
||
| # only triggers on pull request closed events | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| release_type: | ||
| type: string | ||
| description: 'The type of release to make' | ||
| required: true | ||
|
|
||
| jobs: | ||
| rebase_dev: | ||
| env: | ||
| SOURCE_BRANCH: ${{ inputs.release_type == 'patch' && 'testing' || 'stable' }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: "dev" | ||
| fetch-depth: 0 | ||
| - name: Set up Git Authentication | ||
| run: | | ||
| git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | ||
| - name: Rebase testing onto dev | ||
emphasize marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| run: | | ||
| git fetch origin ${{ env.SOURCE_BRANCH }} | ||
| git rebase origin/${{ env.SOURCE_BRANCH }} | ||
| - name: Push changes | ||
| run: | | ||
| git push origin dev | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this API key? Is it something that should be available as an org secret?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is DeepL. I'm not sure if usage will fit into the free tier with more than a few active repos so the org might need a paid key to implement this everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
free tier (500k) api key. not quite clear about the irritation.