Do not rely on missing /etc/os-release file in CI workflow

This commit is contained in:
Alejandro González 2023-07-10 22:59:39 +02:00 committed by Josh Holmer
parent b22b5b24e0
commit 4738db547b

View file

@ -27,16 +27,16 @@ jobs:
include: include:
- target: x86_64-unknown-linux-gnu - target: x86_64-unknown-linux-gnu
os: ubuntu-latest os: ubuntu-22.04
target-apt-arch: amd64 target-apt-arch: amd64
- target: x86_64-unknown-linux-musl - target: x86_64-unknown-linux-musl
os: ubuntu-latest os: ubuntu-22.04
target-apt-arch: amd64 target-apt-arch: amd64
- target: aarch64-unknown-linux-gnu - target: aarch64-unknown-linux-gnu
os: ubuntu-latest os: ubuntu-22.04
target-apt-arch: arm64 target-apt-arch: arm64
- target: aarch64-unknown-linux-musl - target: aarch64-unknown-linux-musl
os: ubuntu-latest os: ubuntu-22.04
target-apt-arch: arm64 target-apt-arch: arm64
- target: x86_64-pc-windows-msvc - target: x86_64-pc-windows-msvc
os: windows-latest os: windows-latest
@ -57,12 +57,11 @@ jobs:
- name: Set up Ubuntu multiarch - name: Set up Ubuntu multiarch
if: startsWith(matrix.os, 'ubuntu') && matrix.target-apt-arch != 'amd64' if: startsWith(matrix.os, 'ubuntu') && matrix.target-apt-arch != 'amd64'
run: | run: |
. /etc/os-release readonly DISTRO_CODENAME=jammy
sudo dpkg --add-architecture "${{ matrix.target-apt-arch }}" sudo dpkg --add-architecture "${{ matrix.target-apt-arch }}"
sudo sed -i "s/^deb http/deb [arch=$(dpkg-architecture -q DEB_HOST_ARCH)] http/" /etc/apt/sources.list sudo sed -i "s/^deb http/deb [arch=$(dpkg-architecture -q DEB_HOST_ARCH)] http/" /etc/apt/sources.list
for suite in '' '-updates' '-backports' '-security'; do for suite in '' '-updates' '-backports' '-security'; do
echo "deb [arch=${{ matrix.target-apt-arch }}] http://ports.ubuntu.com/ $DISTRIB_CODENAME$suite main universe multiverse" | \ echo "deb [arch=${{ matrix.target-apt-arch }}] http://ports.ubuntu.com/ $DISTRO_CODENAME$suite main universe multiverse" | \
sudo tee -a /etc/apt/sources.list >/dev/null sudo tee -a /etc/apt/sources.list >/dev/null
done done