Skip to content

Commit add8865

Browse files
authored
Add shell completion files to the release zip file (#15)
1 parent fea3a17 commit add8865

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

.github/workflows/release.yml

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: release
33
on:
44
push:
55
tags:
6-
- 'v[0-9]+.[0-9]+.[0-9]+'
6+
- "v*"
77

88
jobs:
99
create_release:
@@ -71,27 +71,31 @@ jobs:
7171
os: ubuntu-18.04
7272
rust: stable
7373
target: x86_64-unknown-linux-musl
74+
arch: x86_64
7475
strip: strip
7576
- build: linux-armv7
7677
os: ubuntu-18.04
7778
rust: stable
7879
target: armv7-unknown-linux-gnueabihf
80+
arch: armv7
7981
strip: arm-linux-gnueabihf-strip
8082
- build: linux-aarch64
8183
os: ubuntu-18.04
8284
rust: stable
8385
target: aarch64-unknown-linux-musl
86+
arch: aarch64
8487
strip: aarch64-linux-musl-strip
8588
- build: macos
8689
os: macOS-latest
8790
rust: stable
8891
target: x86_64-apple-darwin
92+
arch: x86_64
8993
strip: strip
9094
# - build: macos-aarch64
9195
# os: macOS-latest
9296
# rust: stable
9397
# target: aarch64-apple-darwin
94-
# strip: strip
98+
# strip: strip
9599

96100
steps:
97101
- name: Checkout repository
@@ -139,21 +143,40 @@ jobs:
139143
- name: Strip release binary (arm)
140144
if: matrix.build == 'linux-armv7' || matrix.build == 'linux-aarch64'
141145
run: |
142-
docker run --rm -v \
143-
"$PWD/target:/target:Z" \
146+
docker run --rm -v $PWD/target:/target:Z \
144147
rustembedded/cross:${{ matrix.target }} \
145-
${{ matrix.strip }} \
146-
/target/${{ matrix.target }}/release/phpup
148+
${{ matrix.strip }} /target/${{ matrix.target }}/release/phpup
149+
150+
- name: Generate completion files
151+
if: matrix.build == 'linux' || matrix.build == 'macos'
152+
run: |
153+
mkdir -p completions/{bash,zsh}
154+
./target/${{ matrix.target }}/release/phpup completions --shell bash > completions/bash/_phpup
155+
./target/${{ matrix.target }}/release/phpup completions --shell zsh > completions/zsh/_phpup
156+
157+
- name: Generate completion files (arm)
158+
if: matrix.build == 'linux-armv7' || matrix.build == 'linux-aarch64'
159+
uses: uraimo/run-on-arch-action@v2.1.1
160+
with:
161+
arch: ${{ matrix.arch }}
162+
distro: ubuntu20.04
163+
githubToken: ${{ github.token }}
164+
dockerRunArgs: |
165+
-v $PWD/target:/target:Z \
166+
-v $PWD/completions:/completions:Z
167+
run: |
168+
mkdir -p completions/{bash,zsh}
169+
./target/${{ matrix.target }}/release/phpup completions --shell bash > completions/bash/_phpup
170+
./target/${{ matrix.target }}/release/phpup completions --shell zsh > completions/zsh/_phpup
147171
148172
- name: Build archive
149173
shell: bash
150174
run: |
151175
staging=phpup-${{ matrix.build }}
152-
mkdir -p $staging/completions/{bash,zsh}
176+
mkdir $staging
153177
cp {README.md,LICENSE} $staging/
154178
cp target/${{ matrix.target }}/release/phpup $staging/
155-
$staging/phpup completions --shell bash > $staging/completions/bash/_phpup
156-
$staging/phpup completions --shell zsh > $staging/completions/zsh/_phpup
179+
cp -r completions $staging/
157180
zip -r $staging.zip $staging
158181
echo "ASSET=$staging.zip" >> $GITHUB_ENV
159182

0 commit comments

Comments
 (0)