Repository navigation
145 lines (125 loc) · 4.14 KB
/
Copy pathrelease.yml
File metadata and controls
145 lines (125 loc) · 4.14 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
143
144
145
name: Release
on:
push:
tags:
- 'v*'
# Run by hand to build the latest release's binaries again.
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
artifact: pointer-linux-x86_64
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
artifact: pointer-linux-aarch64
- target: x86_64-apple-darwin
os: macos-latest
artifact: pointer-macos-x86_64
- target: aarch64-apple-darwin
os: macos-latest
artifact: pointer-macos-aarch64
steps:
- name: Find the release to build
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
# A tag push builds that tag. A run by hand builds the latest release again.
if [ "$GITHUB_REF_TYPE" = tag ]; then tag=$GITHUB_REF_NAME
else tag=$(gh release view -R "$GITHUB_REPOSITORY" --json tagName -q .tagName); fi
echo "TAG=$tag" >> "$GITHUB_ENV"
- uses: actions/checkout@v7
with:
path: pointer
ref: ${{ env.TAG }}
- name: Checkout crust
uses: actions/checkout@v7
with:
repository: isene/crust
path: crust
- name: Checkout glow
uses: actions/checkout@v7
with:
repository: isene/glow
path: glow
- name: Checkout highlight
uses: actions/checkout@v7
with:
repository: isene/highlight
path: highlight
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools
if: matrix.target == 'aarch64-unknown-linux-musl'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Build
working-directory: pointer
run: cargo build --release --target ${{ matrix.target }}
- name: Package
working-directory: pointer
run: |
cp target/${{ matrix.target }}/release/pointer ../${{ matrix.artifact }}
chmod +x ../${{ matrix.artifact }}
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
- name: Create Release
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v3
with:
generate_release_notes: true
body: |
## Installation
Download the binary for your platform:
```bash
chmod +x pointer-*
./pointer-linux-x86_64 # or your platform
```
Optionally copy to your PATH:
```bash
sudo cp pointer-linux-x86_64 /usr/local/bin/pointer
```
## Platforms
- `pointer-linux-x86_64` - Linux (Intel/AMD 64-bit)
- `pointer-linux-aarch64` - Linux (ARM 64-bit, Raspberry Pi)
- `pointer-macos-x86_64` - macOS (Intel)
- `pointer-macos-aarch64` - macOS (Apple Silicon)
- name: Upload the binaries, one at a time
env:
GH_TOKEN: ${{ github.token }}
run: |
# The upload endpoint answers 500 when several files go up at once.
tag=$GITHUB_REF_NAME
[ "$GITHUB_REF_TYPE" = tag ] || tag=$(gh release view --json tagName -q .tagName)
for f in artifacts/*/*; do
for try in 1 2 3; do
gh release upload "$tag" "$f" --clobber && break
echo "upload of $f failed; waiting 10 s"
sleep 10
done
done