This repository has been archived by the owner on May 2, 2024. It is now read-only.
deps(go): bump github.com/spf13/cobra from 1.7.0 to 1.8.0 (#386) #239
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update translations and Rust packaging related files in main | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- po/* | |
- debian/control | |
concurrency: auto-update | |
jobs: | |
update-po: | |
name: Update po files | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo DEBIAN_FRONTEND=noninteractive apt update | |
sudo DEBIAN_FRONTEND=noninteractive apt install -y gettext | |
# Checkout code with git | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
# Install go | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
# Update po if needed | |
- name: Check po files | |
id: checkpo | |
run: | | |
set -eu | |
hasModif="false" | |
go generate ./internal/i18n/ | |
# Exclude line diffs only | |
MODIFIED=$(git difftool -y -x "diff -Nup -I '^#: '" po/) | |
if [ -n "$MODIFIED" ]; then | |
hasModif="true" | |
fi | |
echo "modified=${hasModif}" >> $GITHUB_ENV | |
- name: Create Pull Request | |
if: ${{ env.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/ubuntu/aad-auth/actions/workflows/auto-updates.yaml) by GitHub Action" | |
branch: auto-update-po | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push branch | |
if: ${{ env.modified == 'true' }} | |
run: | | |
git push origin auto-update-po:main | |
update-rust-packaging: | |
name: Update packaging related Rust files | |
needs: update-po | |
runs-on: ubuntu-latest | |
# Right now, ubuntu 22.04 does not have the dh-cargo-vendored-sources script that is needed to | |
# run this job, so we need to run it inside a rolling container to get the latest version possible. | |
# This should be updated as soon as the dh-cargo version with the mentioned script gets ported to | |
# 22.04 or ubuntu-latest changes to a more recent version. | |
container: | |
image: ubuntu:rolling | |
steps: | |
- name: Install dependencies | |
run: | | |
DEBIAN_FRONTEND=noninteractive apt update | |
DEBIAN_FRONTEND=noninteractive apt install -y cargo dh-cargo git jq | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Vendor the dependencies | |
run: | | |
cargo vendor vendor_rust/ | |
- name: Update XS-Vendored-Sources-Rust | |
run: | | |
set -eu | |
export CARGO_VENDOR_DIR=vendor_rust/ | |
VENDORED_SOURCES=$(/usr/share/cargo/bin/dh-cargo-vendored-sources 2>&1 || true) | |
OUTPUT=$(echo "$VENDORED_SOURCES" | grep ^XS-Vendored-Sources-Rust: || true) | |
if [ -z "$OUTPUT" ]; then | |
echo "XS-Vendored-Sources-Rust is up to date. No change is needed."; | |
exit 0 | |
fi | |
sed -i "s/^XS-Vendored-Sources-Rust:.*/$OUTPUT/" debian/control | |
echo "modified=true" >> $GITHUB_ENV | |
shell: bash | |
# Since we run this job in a container, we need to manually add the safe directory due to some | |
# issues between actions/checkout and actions/runner, which seem to be triggered by multiple | |
# causes (e.g. https://github.com/actions/runner-images/issues/6775, https://github.com/actions/checkout/issues/1048#issuecomment-1356485556). | |
- name: work around permission issue with git vulnerability (we are local here). TO REMOVE | |
run: git config --global --add safe.directory /__w/aad-auth/aad-auth | |
- name: Create Pull Request | |
if: ${{ env.modified == 'true' }} | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
commit-message: Auto update packaging related Rust files | |
title: Auto update packaging related Rust files | |
labels: control, automated pr | |
branch: auto-update-rust-packaging | |
delete-branch: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push branch | |
if: ${{ env.modified == 'true' }} | |
run: | | |
git push origin auto-update-rust-packaging:main |