-
Notifications
You must be signed in to change notification settings - Fork 4
100 lines (98 loc) · 3.26 KB
/
generate_rosdep_yaml.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: generate_rosdep_yaml
on:
schedule:
- cron: 0 0 * * *
push:
branches: [ master ]
workflow_dispatch:
jobs:
generate_rosdep_yaml:
name: generate_rosdep_yaml
runs-on: ubuntu-22.04
steps:
- name: basic install
run: |
sudo apt install make ansible
- name: ansible version
run: |
ansible-playbook --version
- uses: actions/checkout@v4
- name: run ansible
run: |
ansible-playbook -i ansible/hosts/localhost.ini ansible/export_repos.yml --connection local --become -e ansible_user=ubuntu
- name: run script
run: |
python3 generate_rosdep_yaml.py ../robotx_ws/src/
working-directory: scripts
- uses: actions/upload-artifact@v4
with:
name: rosdep_yaml
path: scripts/rosdep.yaml
- uses: actions/upload-artifact@v4
with:
name: repos_file
path: |
ansible/packages.repos
ansible/packages_exact.repos
deploy_to_ouxt_distro:
name: deploy_to_ouxt_distro
runs-on: ubuntu-22.04
needs: generate_rosdep_yaml
steps:
- uses: actions/checkout@v4
with:
repository: OUXT-Polaris/ouxt_distro
token: ${{ secrets.WAMV_TAN_BOT_SECRET }}
- uses: actions/download-artifact@v4
with:
name: rosdep_yaml
- uses: actions/download-artifact@v4
with:
name: repos_file
- name: Check branch exist
id: check_branch
run: |
echo "name=exist::$(git ls-remote --heads https://github.com/OUXT-Polaris/ouxt_distro.git deploy | wc -l)" >> "$GITHUB_OUTPUT"
- name: Count changes
id: changes
run: |
git add -N .
echo "name=count::$(git diff --name-only | wc -l)" >> "$GITHUB_OUTPUT"
- name: Check default branch
id: check_default_branch
run: |
echo "name=default_branch::$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')" >> "$GITHUB_OUTPUT"
- uses: peter-evans/create-pull-request@v3
id: create_pull_request
if: steps.check_branch.outputs.exist == 0 && steps.changes.outputs.count > 0
with:
token: ${{ secrets.WAMV_TAN_BOT_SECRET }}
commit-message: Update rosdep.yaml
committer: wam-v-tan <[email protected]>
author: wam-v-tan <[email protected]>
signoff: false
branch: deploy
base: ${{ steps.check_default_branch.outputs.default_branch }}
delete-branch: true
title: '[Bot] Update workflow'
body: |
# Description
Update rosdep.yaml
# How to check
Please check passing all CI test.
labels: |
bot
assignees: wam-v-tan
reviewers: wam-v-tan
team-reviewers: |
owners
maintainers
draft: false
- name: Enable Pull Request Automerge
if: steps.create_pull_request.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v1
with:
token: ${{ secrets.WAMV_TAN_BOT_SECRET }}
pull-request-number: ${{ steps.create_pull_request.outputs.pull-request-number }}
merge-method: squash
repository: OUXT-Polaris/ouxt_distro