Skip to content

Commit ca03cec

Browse files
committed
v1: cd fixes
1 parent abe3703 commit ca03cec

4 files changed

Lines changed: 67 additions & 29 deletions

File tree

‎.github/Dockerfile‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ RUN echo 'export PS1="\\[\\033[38;5;63m\\]pkgx\\[\\033[0m\\]\\w $ "' >> /root/.b
55
RUN pkgx integrate
66

77
FROM debian:buster-slim as stage1
8-
RUN apt-get update && apt --yes install libc-dev libstdc++-8-dev libgcc-8-dev netbase libudev-dev
98
COPY --from=stage0 /usr/local/bin/pkgx /usr/local/bin/pkgx
9+
RUN if [ -f /etc/debian_version ] && grep -q '^10' /etc/debian_version; then \
10+
sed -i 's/deb\.debian/archive\.debian/g' /etc/apt/sources.list; \
11+
fi && \
12+
apt-get update && apt --yes install libc-dev libstdc++-8-dev libgcc-8-dev netbase libudev-dev
1013
COPY --from=stage0 /root/.bashrc /root/.bashrc
1114
ENV BASH_ENV /root/.bashrc
1215
SHELL ["/bin/bash", "-c"]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: setup-apt
2+
description: Update Debian Buster apt sources if needed, then install packages.
3+
inputs:
4+
packages:
5+
description: Space-separated package list for apt-get install.
6+
required: true
7+
runs:
8+
using: composite
9+
steps:
10+
- shell: sh
11+
run: |
12+
SUDO=
13+
if command -v sudo >/dev/null 2>&1; then
14+
SUDO=sudo
15+
fi
16+
17+
if [ -f /etc/debian_version ] && grep -q '^10' /etc/debian_version; then
18+
echo "Debian Buster detected, updating apt-get sources."
19+
$SUDO sed -i 's/deb\.debian/archive\.debian/g' /etc/apt/sources.list
20+
fi
21+
$SUDO apt-get update
22+
$SUDO apt-get install --yes ${{ inputs.packages }}

‎.github/workflows/cd.yml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,17 @@ jobs:
7272
env:
7373
FILENAME: pkgx-${{ github.event.inputs.version }}+${{ matrix.platform.build-id }}.tar.xz
7474
steps:
75+
- uses: actions/checkout@v4
7576
- uses: actions/download-artifact@v4
7677
with:
7778
name: srcs
7879

79-
- uses: pkgxdev/setup@v2
80+
- uses: ./.github/actions/setup-apt
81+
if: startsWith(matrix.platform.build-id, 'linux+')
8082
with:
81-
+: unzip xz
83+
packages: xz-utils unzip
8284

83-
- run: pkgx +xz tar xJf pkgx-${{ github.event.inputs.version }}.tar.xz --strip-components=1
85+
- run: tar xJf pkgx-${{ github.event.inputs.version }}.tar.xz --strip-components=1
8486

8587
# we would prefer this, but our pkging is not stable enough :/
8688
# - uses: pkgxdev/dev@v0

‎.github/workflows/ci.shellcode.yml‎

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
paths:
66
- src/modes/shellcode.*
77
- src/prefab/construct-env.*
8+
- .github/actions/setup-apt/**
89
- .github/workflows/ci.shellcode.yml
910

1011
workflow_call:
@@ -41,10 +42,12 @@ jobs:
4142
path: /usr/local/bin
4243
name: pkgx
4344

44-
- name: prep
45-
run: |
46-
apt-get update && apt-get --yes install bash libatomic1
47-
chmod u+x /usr/local/bin/pkgx
45+
- uses: actions/checkout@v4
46+
- run: chmod u+x /usr/local/bin/pkgx
47+
shell: sh
48+
- uses: ./.github/actions/setup-apt
49+
with:
50+
packages: bash libatomic1
4851

4952
- run: |
5053
test -n "$BASH_VERSION"
@@ -134,11 +137,12 @@ jobs:
134137
path: /usr/local/bin
135138
name: pkgx
136139

137-
- name: prep
138-
run: |
139-
apt-get update && apt-get --yes install zsh libatomic1
140-
chmod u+x /usr/local/bin/pkgx
141-
shell: sh # ∵ cannot be zsh until zsh is installed
140+
- uses: actions/checkout@v4
141+
- run: chmod u+x /usr/local/bin/pkgx
142+
shell: sh
143+
- uses: ./.github/actions/setup-apt
144+
with:
145+
packages: zsh libatomic1
142146

143147
# NOTE matrix does not work for the shell key :-/
144148
- run: |
@@ -239,10 +243,12 @@ jobs:
239243
path: /usr/local/bin
240244
name: pkgx
241245

242-
- name: prep
243-
run: |
244-
apt-get update && apt-get --yes install libatomic1
245-
chmod u+x /usr/local/bin/pkgx
246+
- uses: actions/checkout@v4
247+
- run: chmod u+x /usr/local/bin/pkgx
248+
shell: sh
249+
- uses: ./.github/actions/setup-apt
250+
with:
251+
packages: libatomic1
246252

247253
# NOTE matrix does not work for the shell key :-/
248254
- name: test `use` shellcode
@@ -302,10 +308,12 @@ jobs:
302308
path: /usr/local/bin
303309
name: pkgx
304310

305-
- name: prep
306-
run: |
307-
apt-get update && apt-get --yes install bash libatomic1
308-
chmod u+x /usr/local/bin/pkgx
311+
- uses: actions/checkout@v4
312+
- run: chmod u+x /usr/local/bin/pkgx
313+
shell: sh
314+
- uses: ./.github/actions/setup-apt
315+
with:
316+
packages: bash libatomic1
309317

310318
- run: |
311319
eval "$(pkgx --shellcode)"
@@ -345,10 +353,12 @@ jobs:
345353
path: /usr/local/bin
346354
name: pkgx
347355

348-
- name: prep
349-
run: |
350-
apt-get update && apt-get --yes install bash libatomic1
351-
chmod u+x /usr/local/bin/pkgx
356+
- uses: actions/checkout@v4
357+
- run: chmod u+x /usr/local/bin/pkgx
358+
shell: sh
359+
- uses: ./.github/actions/setup-apt
360+
with:
361+
packages: bash libatomic1
352362

353363
- run: |
354364
echo '#!/usr/bin/env -S pkgx +ack node' > foo
@@ -444,11 +454,12 @@ jobs:
444454
with:
445455
path: /usr/local/bin
446456
name: pkgx
447-
- name: prep
448-
run: |
449-
sudo apt-get update && sudo apt-get --yes install zsh libatomic1
450-
chmod u+x /usr/local/bin/pkgx
457+
- uses: actions/checkout@v4
458+
- run: chmod u+x /usr/local/bin/pkgx
451459
shell: sh
460+
- uses: ./.github/actions/setup-apt
461+
with:
462+
packages: zsh libatomic1
452463
- run: |
453464
alias x="echo hi"
454465
eval "$(pkgx --shellcode)"

0 commit comments

Comments
 (0)