@@ -67,3 +67,102 @@ jobs:
6767 run : cargo publish --token ${CARGO_REGISTRY_TOKEN}
6868 env :
6969 CARGO_REGISTRY_TOKEN : ${{ secrets.CARGO_REGISTRY_TOKEN }}
70+
71+
72+ build-cli-artifacts :
73+ needs : [tag-release]
74+ runs-on : ${{ matrix.os }}
75+ env :
76+ TARGET_FLAGS :
77+ strategy :
78+ fail-fast : false
79+ matrix :
80+ include :
81+ - os : ubuntu-latest
82+ target : aarch64-unknown-linux-gnu
83+ - os : ubuntu-latest
84+ target : aarch64-unknown-linux-musl
85+ - os : ubuntu-latest
86+ target : x86_64-unknown-linux-gnu
87+ - os : ubuntu-latest
88+ target : x86_64-unknown-linux-musl
89+ - os : macos-latest
90+ target : x86_64-apple-darwin
91+ - os : macos-latest
92+ target : x86_64-apple-darwin
93+ - os : macos-latest
94+ target : aarch64-apple-darwin
95+ - os : windows-latest
96+ target : aarch64-pc-windows-msvc
97+ - os : windows-latest
98+ target : x86_64-pc-windows-msvc
99+
100+ steps :
101+ - name : Checkout repository
102+ uses : actions/checkout@v5
103+
104+ - name : Set up Rust
105+ run : rustup toolchain add --profile minimal --target ${{ matrix.target }} stable
106+
107+ - name : Install cross
108+ run : cargo install cross
109+
110+ - name : Set target variables
111+ shell : bash
112+ run : |
113+ echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV
114+ echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV
115+
116+ - name : Build release binary
117+ shell : bash
118+ # cd ensures we only pull in CLI dependencies
119+ run : |
120+ cross build --release ${{ env.TARGET_FLAGS }}
121+ if [ "${{ matrix.os }}" = "windows-latest" ]; then
122+ bin="target/${{ matrix.target }}/release/epoch.exe"
123+ else
124+ bin="target/${{ matrix.target }}/release/epoch"
125+ fi
126+ stat $bin
127+ echo "BIN=$bin" >> $GITHUB_ENV
128+
129+ - name : Determine archive name
130+ shell : bash
131+ run : |
132+ version="$(scripts/get_version.sh)"
133+ echo "ARCHIVE=epoch-$version-${{ matrix.target }}" >> $GITHUB_ENV
134+ echo "VERSION=$version" >> $GITHUB_ENV
135+
136+ - name : Creating directory for archive
137+ shell : bash
138+ run : |
139+ mkdir -p "$ARCHIVE"/doc
140+ cp "$BIN" "$ARCHIVE"/
141+ cp {README.md,LICENSE} "$ARCHIVE"/
142+ cp CHANGELOG.md "$ARCHIVE"/doc/
143+
144+ - name : Build archive (Windows)
145+ shell : bash
146+ if : matrix.os == 'windows-latest'
147+ run : |
148+ 7z a "$ARCHIVE.zip" "$ARCHIVE"
149+ certutil -hashfile "$ARCHIVE.zip" SHA256 > "$ARCHIVE.zip.sha256"
150+ echo "ASSET=$ARCHIVE.zip" >> $GITHUB_ENV
151+ echo "ASSET_SUM=$ARCHIVE.zip.sha256" >> $GITHUB_ENV
152+
153+ - name : Build archive (Unix)
154+ shell : bash
155+ if : matrix.os != 'windows-latest'
156+ run : |
157+ tar czf "$ARCHIVE.tar.gz" "$ARCHIVE"
158+ shasum -a 256 "$ARCHIVE.tar.gz" > "$ARCHIVE.tar.gz.sha256"
159+ echo "ASSET=$ARCHIVE.tar.gz" >> $GITHUB_ENV
160+ echo "ASSET_SUM=$ARCHIVE.tar.gz.sha256" >> $GITHUB_ENV
161+
162+ - name : Upload release archive
163+ env :
164+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
165+ shell : bash
166+ # clobber to overwrite if we have to rerun the release
167+ run : |
168+ gh release upload v${{ env.VERSION }} ${{ env.ASSET }} ${{ env.ASSET_SUM }} --clobber
0 commit comments