-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (119 loc) · 4.25 KB
/
release.yml
File metadata and controls
142 lines (119 loc) · 4.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install cross-compilation tools
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build
run: cargo build --release --target ${{ matrix.target }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Package
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../wpx-${{ matrix.target }}.tar.gz wpx
- name: Generate man pages
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: |
mkdir -p dist/man
cargo run --release --target ${{ matrix.target }} -- man --dir dist/man
tar czf wpx-man-pages.tar.gz -C dist/man .
- name: Upload assets
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "$GITHUB_REF_NAME" wpx-*.tar.gz --clobber || true
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "$GITHUB_REF_NAME" \
--title "wpx $GITHUB_REF_NAME" \
--generate-notes || true
homebrew:
needs: build
runs-on: ubuntu-latest
steps:
- name: Update Homebrew tap
env:
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
set -euo pipefail
VERSION="${GITHUB_REF_NAME#v}"
BASE_URL="https://github.com/osodevops/wordpress-cli/releases/download/${GITHUB_REF_NAME}"
curl -fsSL "${BASE_URL}/wpx-aarch64-apple-darwin.tar.gz" -o arm64.tar.gz
curl -fsSL "${BASE_URL}/wpx-x86_64-apple-darwin.tar.gz" -o x86_64_mac.tar.gz
curl -fsSL "${BASE_URL}/wpx-x86_64-unknown-linux-gnu.tar.gz" -o x86_64_linux.tar.gz
SHA_ARM64=$(sha256sum arm64.tar.gz | awk '{print $1}')
SHA_X86_64_MAC=$(sha256sum x86_64_mac.tar.gz | awk '{print $1}')
SHA_X86_64_LINUX=$(sha256sum x86_64_linux.tar.gz | awk '{print $1}')
cat > wordpress-cli.rb <<FORMULA
class WordpressCli < Formula
desc "Rust-native WordPress CLI for AI agents & humans"
homepage "https://github.com/osodevops/wordpress-cli"
version "${VERSION}"
license "MIT"
on_macos do
if Hardware::CPU.arm?
url "${BASE_URL}/wpx-aarch64-apple-darwin.tar.gz"
sha256 "${SHA_ARM64}"
else
url "${BASE_URL}/wpx-x86_64-apple-darwin.tar.gz"
sha256 "${SHA_X86_64_MAC}"
end
end
on_linux do
url "${BASE_URL}/wpx-x86_64-unknown-linux-gnu.tar.gz"
sha256 "${SHA_X86_64_LINUX}"
end
def install
bin.install "wpx"
end
test do
assert_match "wpx", shell_output("#{bin}/wpx --version")
end
end
FORMULA
sed -i 's/^ //' wordpress-cli.rb
git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/osodevops/homebrew-tap.git" tap
cp wordpress-cli.rb tap/Formula/wordpress-cli.rb
cd tap
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/wordpress-cli.rb
git commit -m "wordpress-cli ${VERSION}"
git push