Skip to content

Commit bec62ff

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

File tree

2 files changed

+34
-25
lines changed

2 files changed

+34
-25
lines changed

.github/workflows/cd.www.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ jobs:
5757
go $filename Linux x86_64
5858
./out/Linux/x86_64 --version | awk '{print $2}' > out/VERSION
5959
;;
60+
*+windows+x86-64.tar.xz)
61+
go $filename Windows x86_64;;
6062
esac
6163
done
6264

.github/workflows/cd.yml

Lines changed: 32 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 }}.tar
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,11 @@ 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 ${{env.BASENAME}}.xz pkgx${{ env.EXT }}
150+
tar czf ${{env.BASENAME}}.gz pkgx${{ env.EXT }}
142151
143-
- name: GPG sign archive
152+
- name: GPG sign archives
144153
run: |
145154
./pkgx gpg-agent --daemon || true
146155
echo $GPG_PRIVATE_KEY | \
@@ -149,18 +158,16 @@ jobs:
149158
./pkgx gpg \
150159
--detach-sign --armor \
151160
--local-user $GPG_KEY_ID \
152-
$FILENAME
161+
$BASENAME.xz
153162
env:
154163
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
155164
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
156-
157-
- run: echo 'naughty-boy' > $FILENAME.asc
158-
if: matrix.platform.build-id == 'linux+x86-64'
165+
if: ${{ runner.os != 'Windows' }}
159166

160167
- name: attach product to release
161-
run: ./pkgx gh release upload --clobber
168+
run: gh release upload --clobber
162169
v${{ github.event.inputs.version }}
163-
$FILENAME $FILENAME.asc
170+
${{env.BASENAME}}.xz ${{env.BASENAME}}.gz ${{env.BASENAME}}.xz.asc
164171
env:
165172
# using this token rather than github.token due to `release not found` bug
166173
# https://github.com/pkgxdev/cli/issues/5252

0 commit comments

Comments
 (0)