Skip to content

Commit ebf754b

Browse files
committed
cd for windows
1 parent 8660a06 commit ebf754b

File tree

2 files changed

+44
-27
lines changed

2 files changed

+44
-27
lines changed

.github/workflows/cd.www.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
with:
3131
releaseId: ${{ github.event.release.id }}
3232
tag: ${{ github.event.inputs.tag }}
33-
fileName: pkgx-*.tar.xz
33+
fileName: pkgx-*.*
3434

3535
- name: Unpack Binaries
3636
run: |
@@ -44,7 +44,7 @@ jobs:
4444
INVALIDATION_PATHS="$INVALIDATION_PATHS /$2/$3 /$2/$3.tgz /$2/$3.gz"
4545
}
4646
47-
for filename in pkgx-*+*+*.tar.xz; do
47+
for filename in pkgx-*+*+*.*; do
4848
case $filename in
4949
*+darwin+aarch64.tar.xz)
5050
go $filename Darwin arm64;;
@@ -57,6 +57,11 @@ jobs:
5757
go $filename Linux x86_64
5858
./out/Linux/x86_64 --version | awk '{print $2}' > out/VERSION
5959
;;
60+
*+windows+x86-64.zip)
61+
mkdir -p out/Windows
62+
mv $filename out/Windows/x86_64.zip
63+
INVALIDATION_PATHS="$INVALIDATION_PATHS /Windows/x86_64.zip"
64+
;;
6065
esac
6166
done
6267

.github/workflows/cd.yml

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
qa:
1818
strategy:
1919
matrix:
20-
os: [ubuntu-latest, macos-latest]
20+
os: [ubuntu-latest, macos-latest, windows-latest]
2121
runs-on: ${{ matrix.os }}
2222
steps:
2323
- uses: actions/checkout@v4
@@ -39,13 +39,13 @@ jobs:
3939
run: rm -rf ${{ env.FILENAME }}/.github .gitbook.yml
4040
- name: include GPG pubkey
4141
run: echo "${{ secrets.GPG_PUBLIC_KEY }}" | base64 -d > $FILENAME/pkgx.dev.pub.asc
42-
- run: tar cJf $FILENAME.tar.xz $FILENAME
43-
- run: tar czf $FILENAME.tar.gz $FILENAME
42+
- run: |
43+
tar cJf $FILENAME.tar.xz $FILENAME
44+
tar czf $FILENAME.tar.gz $FILENAME
4445
- name: attach srcs to release
4546
run: gh release upload --clobber
4647
v${{ github.event.inputs.version }}
4748
../$FILENAME.tar.xz
48-
../$FILENAME.tar.gz
4949
working-directory:
5050
${{ env.FILENAME }}
5151
env:
@@ -55,7 +55,7 @@ jobs:
5555
- uses: actions/upload-artifact@v4
5656
with:
5757
name: srcs
58-
path: ${{ env.FILENAME }}.tar.xz
58+
path: ${{ env.FILENAME }}.tar.gz
5959
if-no-files-found: error
6060

6161
attach-binary-products:
@@ -67,20 +67,24 @@ jobs:
6767
platform:
6868
- os: ["self-hosted", "macOS", "X64"]
6969
build-id: darwin+x86-64
70+
pkgs: gh
7071
- os: ubuntu-latest
7172
container: debian:buster-slim
7273
build-id: linux+x86-64
73-
- os: [self-hosted, macOS, ARM64]
74+
pkgs: gh
75+
- os: macos-latest
7476
build-id: darwin+aarch64
7577
- os: [self-hosted, linux, ARM64]
7678
build-id: linux+aarch64
77-
pkgs: llvm.org perl gnu.org/make xz
79+
pkgs: llvm.org perl gnu.org/make xz gh
80+
- os: windows-latest
81+
build-id: windows+x86-64
7882
fail-fast: false
7983
runs-on: ${{ matrix.platform.os }}
8084
name: ${{ matrix.platform.build-id }}
8185
container: ${{ matrix.platform.container }}
8286
env:
83-
FILENAME: pkgx-${{ github.event.inputs.version }}+${{ matrix.platform.build-id }}.tar.xz
87+
BASENAME: pkgx-${{ github.event.inputs.version }}+${{ matrix.platform.build-id }}
8488
steps:
8589
- uses: actions/download-artifact@v4
8690
with:
@@ -99,27 +103,30 @@ jobs:
99103
apt-get update
100104
apt-get install curl gcc perl-modules openssl make xz-utils --yes;;
101105
esac
106+
if: ${{ runner.os == 'Linux' }}
102107

103-
- run: tar xJf pkgx-${{ github.event.inputs.version }}.tar.xz --strip-components=1
108+
- name: Prep
109+
if: ${{ runner.os == 'Windows' }}
110+
run: Add-Content -Path $env:GITHUB_ENV -Value "EXT=.exe"
104111

105-
- uses: dtolnay/rust-toolchain@stable
112+
- run: tar xzf pkgx-${{ github.event.inputs.version }}.tar.gz --strip-components=1
106113

107-
- run: |
108-
cargo build --release
109-
if: ${{ runner.os != 'Linux' }}
114+
- uses: dtolnay/rust-toolchain@stable
110115

111116
# hack to statically link libgcc
112117
- run: |
113118
echo '#!/bin/bash' > linkerdriver.wrap
114119
echo 'exec "${CC:-cc}" "${@/-lgcc_s/-lgcc_eh}"' >> linkerdriver.wrap
115120
chmod +x ./linkerdriver.wrap
116-
117-
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER="$PWD/linkerdriver.wrap" cargo build --release
121+
echo "CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=$PWD/linkerdriver.wrap" >> $GITHUB_ENV
118122
if: ${{ runner.os == 'Linux' }}
119123
120124
- run: |
121-
mv target/release/pkgx .
122-
strip ./pkgx
125+
cargo build --release
126+
mv target/release/pkgx${{ env.EXT }} .
127+
128+
- run: strip ./pkgx
129+
if: ${{ runner.os != 'Windows' }}
123130

124131
- uses: pkgxdev/pantry/.github/actions/setup@main
125132
if: startsWith(matrix.platform.build-id, 'darwin+')
@@ -138,9 +145,15 @@ jobs:
138145
- name: sanity check
139146
run: test "$(./pkgx --version)" = "pkgx ${{ github.event.inputs.version }}"
140147

141-
- run: tar cJf $FILENAME pkgx
148+
- run: |
149+
tar cJf $BASENAME.tar.xz pkgx
150+
tar czf $BASENAME.tar.gz pkgx
151+
if: ${{ runner.os != 'Windows' }}
142152
143-
- name: GPG sign archive
153+
- run: Compress-Archive -Path pkgx.exe -DestinationPath ${{env.BASENAME}}.zip
154+
if: ${{ runner.os == 'Windows' }}
155+
156+
- name: GPG sign archives
144157
run: |
145158
./pkgx gpg-agent --daemon || true
146159
echo $GPG_PRIVATE_KEY | \
@@ -149,20 +162,19 @@ jobs:
149162
./pkgx gpg \
150163
--detach-sign --armor \
151164
--local-user $GPG_KEY_ID \
152-
$FILENAME
165+
$BASENAME.tar.xz
153166
env:
154167
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
155168
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
156-
157-
- run: echo 'naughty-boy' > $FILENAME.asc
158-
if: matrix.platform.build-id == 'linux+x86-64'
169+
if: ${{ runner.os != 'Windows' }}
159170

160171
- name: attach product to release
161-
run: ./pkgx gh release upload --clobber
172+
run: gh release upload --clobber
162173
v${{ github.event.inputs.version }}
163-
$FILENAME $FILENAME.asc
174+
${{env.BASENAME}}.*
164175
env:
165176
# using this token rather than github.token due to `release not found` bug
166177
# https://github.com/pkgxdev/cli/issues/5252
167178
GH_TOKEN: ${{ secrets.GH_TOKEN }}
168179
GH_REPO: pkgxdev/pkgx
180+
shell: bash

0 commit comments

Comments
 (0)