forked from ubuntu/authd
-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (80 loc) · 3.08 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
name: Update translations and Rust packaging related files in main
on:
push:
branches:
- "*"
paths-ignore:
- debian/control
concurrency: auto-update
permissions:
pull-requests: write
contents: write
# Jobs in this action must not run concurrently, as they modify the repository.
# When adding more jobs, make sure to use the "needs:" attribute to make sure they run sequentially.
jobs:
update-rust-packaging:
name: Update packaging related Rust files
runs-on: ubuntu-24.04 # ubuntu-latest-runner
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Vendor the dependencies
uses: kohlerdominik/[email protected]
with:
image: ubuntu:devel
volumes: ${{ github.workspace }}:${{ github.workspace }}
workdir: ${{ github.workspace }}
shell: bash
environment: |
DEBIAN_FRONTEND=noninteractive
run: |
echo "::group::Install dependencies"
set -eu
apt update -y
apt install -y dh-cargo cargo-vendor-filterer git jq
echo "::endgroup::"
echo "::Vendor the dependencies"
export CARGO_VENDOR_DIR=${PWD}/vendor_rust
debian/vendor-rust.sh
echo "::endgroup::"
echo "::Update XS-Vendored-Sources-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}"
echo "::endgroup::"
# - name: Vendor the dependencies
# run: |
# cargo vendor vendor_rust/
# - name: Update XS-Vendored-Sources-Rust
# shell: bash
# 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
- name: Create Pull Request
if: ${{ env.modified == 'true' }}
uses: peter-evans/create-pull-request@v7
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