forked from ubuntu/authd
-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (140 loc) · 5.88 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
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:
strategy:
fail-fast: false
matrix:
ubuntu-version: [devel]
branch: [main]
# dependencies: [ ['cargo-filterer'] ]
include:
- ubuntu-version: noble
branch: noble
name: Update ${{ matrix.ubuntu-version }} packaging related Rust files
runs-on: ubuntu-24.04 # ubuntu-latest-runner
container:
image: ubuntu:${{ matrix.ubuntu-version }}
env:
CARGO_VENDOR_DIR: ${{ github.workspace }}/vendor_rust
UPDATE_BRANCH: auto-update-rust-packaging-${{ matrix.ubuntu-version }}
steps:
- name: Install dependencies
env:
DEBIAN_FRONTEND: noninteractive
CARGO_VENDOR_FILTERER_VERSION: 0.5.16
shell: bash
run: |
set -euo pipefail
apt update -y
apt install -y dh-cargo libssl-dev pkg-config
cargo install --locked --root=/usr \
cargo-vendor-filterer@${{ env.CARGO_VENDOR_FILTERER_VERSION }}
- uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
- 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
# CARGO_VENDOR_DIR=${{ github.workspace }}/vendor_rust
# CARGO_PATH=/usr/share/cargo/bin/cargo
# run: |
# echo "::group::Install dependencies"
# set -euo pipefail
# apt update -y
# apt install -y dh-cargo cargo-vendor-filterer
# echo "::endgroup::"
# set -x
# # FIXME: drop this when it lands...
# apt install -y wget
# wget https://launchpad.net/ubuntu/+source/dh-cargo/31ubuntu4/+build/30122553/+files/dh-cargo_31ubuntu4_all.deb \
# https://launchpad.net/ubuntu/+source/dh-cargo/31ubuntu4/+build/30122553/+files/dh-cargo-tools_31ubuntu4_all.deb
# dpkg -i ./dh-cargo_31ubuntu4_all.deb ./dh-cargo-tools_31ubuntu4_all.deb
# echo "::group::Vendor the dependencies"
# # export CARGO_VENDOR_DIR=${PWD}/vendor_rust
# # export CARGO_PATH=/usr/share/cargo/bin/cargo
# sh -x debian/vendor-rust.sh
# echo "::endgroup::"
# echo "::group::Update XS-Vendored-Sources-Rust"
# VENDORED_SOURCES=$(/usr/share/cargo/bin/dh-cargo-vendored-sources 2>&1 || true) \
# || cmd_status=$?
# OUTPUT=$(echo "$VENDORED_SOURCES" | grep ^XS-Vendored-Sources-Rust: || true)
# if [ -z "$OUTPUT" ]; then
# if [ "${cmd_status:-0}" -ne 0 ]; then
# # dh-cargo-vendored-sources failed because of other reason, so let's fail with it!
# echo "dh-cargo-vendored-sources failed:"
# echo "${VENDORED_SOURCES}"
# exit "${cmd_status}"
# fi
# 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::"
env:
CARGO_PATH: /usr/share/cargo/bin/cargo
shell: bash
run: |
set -euo pipefail
# FIXME: drop this when it lands...
apt install -y wget
wget https://launchpad.net/ubuntu/+source/dh-cargo/31ubuntu4/+build/30122553/+files/dh-cargo_31ubuntu4_all.deb \
https://launchpad.net/ubuntu/+source/dh-cargo/31ubuntu4/+build/30122553/+files/dh-cargo-tools_31ubuntu4_all.deb
dpkg -i ./dh-cargo_31ubuntu4_all.deb ./dh-cargo-tools_31ubuntu4_all.deb
sh -x debian/vendor-rust.sh
- name: Update XS-Vendored-Sources-Rust
shell: bash
run: |
set -euo pipefail
set -x
VENDORED_SOURCES=$(/usr/share/cargo/bin/dh-cargo-vendored-sources 2>&1) \
|| cmd_status=$?
OUTPUT=$(echo "$VENDORED_SOURCES" | grep ^XS-Vendored-Sources-Rust: || true)
if [ -z "${OUTPUT}" ]; then
if [ "${cmd_status:-0}" -ne 0 ]; then
# dh-cargo-vendored-sources failed because of other reason, so let's fail with it!
echo "dh-cargo-vendored-sources failed:"
echo "${VENDORED_SOURCES}"
exit "${cmd_status}"
fi
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: |
# [${{ matrix.ubuntu-version }}] Auto update packaging related Rust files
# labels: control, automated pr
# branch: ${{ env.UPDATE_BRANCH }}
# delete-branch: true
# token: ${{ secrets.GITHUB_TOKEN }}
- name: Push branch
if: ${{ env.modified == 'true' }}
shell: bash
run: |
set -eu
apt install -y git
git push origin ${UPDATE_BRANCH}:${{ matrix.branch }}