-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
126 lines (105 loc) · 3.6 KB
/
Copy pathTaskfile.yaml
File metadata and controls
126 lines (105 loc) · 3.6 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
version: '3'
tasks:
default:
desc: Show the available tasks
cmds:
- task --list --sort alphanumeric
setup:
desc: "Add the macOS Rust targets used for local release builds"
silent: true
status:
- rustup target list --installed | grep -q x86_64-apple-darwin
- rustup target list --installed | grep -q aarch64-apple-darwin
cmds:
- rustup target add x86_64-apple-darwin
- rustup target add aarch64-apple-darwin
test:
desc: "Run all tests"
cmds:
- cargo clippy --all-targets --all-features -- -D warnings
- cargo test --all-features
lint:fix:
desc: "Auto-fix clippy lints where possible (same scope as `task test`)"
cmds:
- cargo clippy --fix --all-targets --all-features --allow-dirty --allow-staged
build:
desc: "Build debug binary for the host"
silent: true
cmds:
- cargo build
- du -h target/debug/dotenv
build:release:
desc: "Build optimized release binary for the host"
silent: true
cmds:
- cargo build --release
- du -h target/release/dotenv
build:release:*:
desc: "Build macOS release binaries for all targets and package into dist/"
vars:
VERSION: '{{index .MATCH 0}}'
silent: true
cmds:
- mkdir -p dist
- rm -f dist/dotenv-cli-*.gz
- |
set -euo pipefail
echo "Building macOS release binaries..."
cargo build --release --target aarch64-apple-darwin
cargo build --release --target x86_64-apple-darwin
du -h target/aarch64-apple-darwin/release/dotenv
du -h target/x86_64-apple-darwin/release/dotenv
echo "Packaging into dist with version {{.VERSION}}..."
gzip -n -c target/aarch64-apple-darwin/release/dotenv \
> dist/dotenv-cli-{{.VERSION}}-apple-darwin-aarch64.gz
gzip -n -c target/x86_64-apple-darwin/release/dotenv \
> dist/dotenv-cli-{{.VERSION}}-apple-darwin-x86_64.gz
echo "Artifacts created:"
ls -lh dist
install:
desc: "Install binary locally via cargo install --path ."
cmds:
- task: uninstall
- cargo install --path .
install:brew:
desc: "Install via Homebrew tap"
cmds:
- task: uninstall
- brew install mikegarde/tap/dotenv-cli
install:npm:
desc: "Local development install via npm"
cmds:
- task: uninstall
- npm install
- task: build:release
- mkdir -p vendor
- cp target/release/dotenv vendor/dotenv
- npm install -g
install:npm:repo:
desc: "Install the published package from the npm registry"
cmds:
- task: uninstall
- npm install -g @mikegarde/dotenv-cli --allow-scripts=@mikegarde/dotenv-cli
uninstall:
desc: "Uninstall all local installations of dotenv-cli (cargo, npm, brew)"
internal: true
cmds:
- cargo uninstall dotenv-cli || true
- brew uninstall mikegarde/tap/dotenv-cli || true
- npm uninstall -g @mikegarde/dotenv-cli || true
release:*:
desc: "Create a release: bump version, build & upload macOS assets, then GitHub Actions builds Linux/Windows, publishes, and updates the Homebrew tap. Usage: task release:[patch|minor|major|X.Y.Z]"
interactive: true
vars:
VERSION: '{{index .MATCH 0}}'
cmds:
- task: test
- bash devops/release.sh {{.VERSION}}
publish:npm:
desc: "Manually publish the current version to npmjs (normally handled by GitHub Actions)"
cmds:
- npm run publish:npm
publish:github:
desc: "Manually publish the current version to GitHub Packages (normally handled by GitHub Actions)"
cmds:
- npm run publish:github