Skip to content

[GUI] Notify purchase (#260) #193

[GUI] Notify purchase (#260)

[GUI] Notify purchase (#260) #193

Workflow file for this run

name: Update translations and documentation
on:
push:
branches:
- main
paths-ignore:
- '**/README.md'
- '**/debian/control'
- '**/po/*'
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@v4
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: |
set -eu
hasModif="false"
for subproject in ${{ env.subprojects }} ; do
go generate "${subproject}/generate/generate-locales.go"
done
# Exclude line diffs only
MODIFIED=$(git difftool -y -x "diff -Nup -I '^#: '" "*/po/*")
if [ -n "$MODIFIED" ]; then
hasModif="true"
fi
echo "modified=${hasModif}" >> $GITHUB_OUTPUT
- name: Create Pull Request
if: steps.checkpo.outputs.modified == 'true'
uses: peter-evans/create-pull-request@v5
with:
commit-message: Auto update po files
title: Auto update po files
labels: po, automated pr
body: "[Auto-generated pull request](https://github.com/canonical/ubuntu-pro-for-windows/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@v4
name: Set up Go
with:
go-version-file: go.work
- name: Check README file
id: check-readme
run: |
set -eu
for subproject in ${{ env.subprojects }} ; do
go generate "${subproject}/generate/generate-docs.go"
done
hasModif="false"
MODIFIED=$(git status --porcelain --untracked-files=no)
if [ -n "$MODIFIED" ]; then
hasModif="true"
fi
echo "modified=${hasModif}" >> $GITHUB_OUTPUT
- uses: peter-evans/create-pull-request@v5
name: Create Pull Request
if: steps.check-readme.outputs.modified == 'true'
with:
commit-message: Auto update readme files
title: Auto update readme files
labels: readme, automated pr
body: "[Auto-generated pull request](https://github.com/canonical/ubuntu-pro-for-windows/actions/workflows/auto-updates.yaml) by GitHub Action"
branch: auto-updates/readme-cli-ref
token: ${{ secrets.GITHUB_TOKEN }}
- name: Push branch
if: steps.check-readme.outputs.modified == 'true'
run: |
git push origin auto-updates/readme-cli-ref:main