-
Notifications
You must be signed in to change notification settings - Fork 6
165 lines (162 loc) · 5.89 KB
/
auto-updates.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Update translations and documentation
on:
push:
branches:
- main
paths-ignore:
- '**/README.md'
- '**/debian/control'
- '**/po/*'
workflow_dispatch:
jobs:
update-po:
name: Update po files
runs-on: ubuntu-latest
env:
subprojects: windows-agent wsl-pro-service
steps:
- name: Install dependencies
run: |
sudo DEBIAN_FRONTEND=noninteractive apt update
sudo DEBIAN_FRONTEND=noninteractive apt install -y gettext git
- uses: actions/checkout@v4
name: Check out repo
with:
ref: main
- uses: actions/setup-go@v5
with:
go-version-file: common/go.mod
- name: Set up git
# This step needs to be done so that the private repo dependencies can be downloaded
uses: ./.github/actions/setup-git
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check po files
id: checkpo
run: |
# Generate locales
set -eu
for subproject in ${{ env.subprojects }} ; do
go generate "${subproject}/generate/generate-locales.go"
done
- name: Find localization changes
id: check-diff
uses: canonical/desktop-engineering/gh-actions/common/has-diff@main
with:
working-directory: .
# Go workspace checksum files tend to update when no one is asking
paths-to-ignore: 'go.work.sum'
fail-on-diff: false
- name: Create Pull Request
if: steps.checkpo.outputs.modified == 'true'
uses: peter-evans/create-pull-request@v7
with:
commit-message: Auto update po files
title: 'docs(i18n): Auto update po files'
labels: po, automated pr
body: "[Auto-generated pull request](https://github.com/canonical/ubuntu-pro-for-wsl/actions/workflows/auto-updates.yaml) by GitHub Action"
branch: auto-updates/locales
token: ${{ secrets.GITHUB_TOKEN }}
- name: Push branch
if: steps.checkpo.outputs.modified == 'true'
run: |
git push origin auto-updates/locales:main
update-readme-cli-ref:
name: Update readme and CLI ref files
runs-on: ubuntu-latest
needs: update-po
env:
subprojects: windows-agent wsl-pro-service
steps:
- name: Install dependencies
run: |
sudo DEBIAN_FRONTEND=noninteractive apt update
sudo DEBIAN_FRONTEND=noninteractive apt install -y git
- uses: actions/checkout@v4
name: Check out repository
with:
ref: main
- name: Set up git
uses: ./.github/actions/setup-git
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-go@v5
name: Set up Go
with:
go-version-file: go.work
- name: Generate documentation
run: |
# Generate documentation
set -eu
for subproject in ${{ env.subprojects }} ; do
go generate "${subproject}/generate/generate-docs.go"
done
- name: Find documentation changes
id: check-diff
uses: canonical/desktop-engineering/gh-actions/common/has-diff@main
with:
working-directory: .
# Go workspace checksum files tend to update when no one is asking
paths-to-ignore: 'go.work.sum'
fail-on-diff: false
- uses: peter-evans/create-pull-request@v7
name: Create Pull Request
if: steps.check-diff.outputs.diff == 'true'
with:
commit-message: Auto update readme files
title: 'docs: Auto update readme files'
labels: readme, automated pr
body: "[Auto-generated pull request](https://github.com/canonical/ubuntu-pro-for-wsl/actions/workflows/auto-updates.yaml) by GitHub Action"
branch: auto-updates/readme-cli-ref
token: ${{ secrets.GITHUB_TOKEN }}
- name: Push branch
if: steps.check-diff.outputs.diff == 'true'
run: |
git push origin auto-updates/readme-cli-ref:main
update-internal-dependencies:
name: Update internal dependencies
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
# ^ 0 means infinity in this context. This is necessary to later be able to compute diffs.
- name: Set up git
uses: ./.github/actions/setup-git
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up go
uses: actions/setup-go@v5
with:
go-version-file: go.work
- name: Set up private repo
shell: bash
run : go env -w "GOPRIVATE=github.com/${{ github.repository }}"
- name: Update submodules
uses: ./.github/actions/update-workspace-dependencies
with:
module: wsl-pro-service
- name: Detect changes
id: check-diff
uses: canonical/desktop-engineering/gh-actions/common/has-diff@main
with:
working-directory: wsl-pro-service
# Go workspace checksum files tend to update when no one is asking
paths-to-ignore: 'go.work.sum'
fail-on-diff: false
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
if: steps.check-diff.outputs.diff == 'true'
with:
commit-message: Auto update internal dependencies
title: 'deps(wsl-pro-service): Auto update WSL-Pro-Service dependencies'
labels: automated pr
body: "[Auto-generated pull request](https://github.com/canonical/ubuntu-pro-for-wsl/actions/workflows/auto-updates.yaml) by GitHub Action"
branch: auto-updates/update-internal-dependencies
token: ${{ secrets.GITHUB_TOKEN }}
- name: Push branch
if: steps.check-diff.outputs.diff == 'true'
run: |
git push origin auto-updates/update-internal-dependencies:main