Merge pull request #1943 from tmccombs/archive-script
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Thayne McCombs · committed by GitHub · parents fe0e455, c276ac7 · Browse files · 4 files·+85 added−37 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- build: Create archive script
Diff stats
4 files+85 added−37 removed
- other:+85 added−37 removed
Provenance
- Commit
cdea7f5- Tree
1d1eb6e- Author
Thayne McCombs <astrothayne@gmail.com>- Committer
GitHub <noreply@github.com>- Parent 1
fe0e455- Parent 2
c276ac7
4 files changed+85 added−37 removed
modified:.github/workflows/CICD.yml+4 added-36 removed
203 unmodified lines204 205 - name: Create tarball206 id: package207 shell: bash208+ run: bash scripts/create-archive.sh209 env:210 BIN_PATH: ${{ steps.bin.outputs.BIN_PATH }}210- version: ${{ needs.crate_metadata.outputs.version }}211- run: |212- PKG_suffix=".tar.gz"213- case ${target} in214- *-pc-windows-*) PKG_suffix=".zip" ;;215- esac216- PKG_BASENAME=${name}-v${version}-${target}217- PKG_NAME=${PKG_BASENAME}${PKG_suffix}218- echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_OUTPUT211+ TARGET: ${{ env.target }}212+ ARCHIVE_NAME: ${{ env.name }}-v${{ needs.crate_metadata.outputs.version }}-${{ env.target }}213+ PKG_STAGING: "${{ env.CICD_INTERMEDIATES_DIR }}/package"214 220- PKG_STAGING="${CICD_INTERMEDIATES_DIR}/package"221- ARCHIVE_DIR="${PKG_STAGING}/${PKG_BASENAME}/"222- mkdir -p "${ARCHIVE_DIR}"223-224- # Binary225- cp "${BIN_PATH}" "$ARCHIVE_DIR"226-227- # README, LICENSE and CHANGELOG files228- cp "README.md" "LICENSE-MIT" "LICENSE-APACHE" "CHANGELOG.md" "$ARCHIVE_DIR"229-230- # Man page231- cp "doc/${name}.1" "$ARCHIVE_DIR"232-233- # Autocompletion files234- cp -r autocomplete "${ARCHIVE_DIR}"235-236- # base compressed package237- pushd "${PKG_STAGING}/" >/dev/null238- case ${target} in239- *-pc-windows-*) 7z -y a "${PKG_NAME}" "${PKG_BASENAME}"/* | tail -2 ;;240- *) tar czf "${PKG_NAME}" "${PKG_BASENAME}"/* ;;241- esac;242- popd >/dev/null243-244- # Let subsequent steps know where to find the compressed package245- echo "PKG_PATH=${PKG_STAGING}/${PKG_NAME}" >> $GITHUB_OUTPUT246-215 - name: Create Debian package216 id: debian-package217 shell: bash218 if: startsWith(matrix.job.os, 'ubuntu')59 unmodified linesadded:scripts/create-archive.sh+67 added
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667#!/bin/bash## Create a .tar.gz archive of the fd project for distribution## Expected environment variables:## TARGET: rust target to publish. Defaults to default rustc target# BIN_PATH: path to fd binary# PKG_STAGING: directory to use for staging files to include in the archive# ARCHIVE_NAME: Name of output file, minus extension, defaults to "fd" with a version appended# if VERSION is specified# VERSION: version to publish# GITHUB_OUTPUT: file to store github output variables in
if [[ -z "$TARGET" ]]; then TARGET="$(rustc -vV | sed -n 's/host: //p')"fi
PKG_suffix=".tar.gz"EXE_suffix=""case ${TARGET} in*-pc-windows-*) PKG_suffix=".zip" EXE_suffix=".exe" ;;esac
if [[ -z $BIN_PATH ]]; then BIN_PATH=target/${PROFILE:-release}/fdfi
if [[ -z "$ARCHIVE_NAME" ]]; then ARCHIVE_NAME=fd [[ -n "$VERSION" ]] && ARCHIVE_NAME+="-v$VERSION"fi
PKG_NAME=${ARCHIVE_NAME}${PKG_suffix}
staging_dir="${PKG_STAGING:-package}"ARCHIVE_DIR="${staging_dir}/${ARCHIVE_NAME}/"mkdir -p "${ARCHIVE_DIR}"
# Binarycp "${BIN_PATH}" "$ARCHIVE_DIR"
# README, LICENSE and CHANGELOG filescp "README.md" "LICENSE-MIT" "LICENSE-APACHE" "CHANGELOG.md" "$ARCHIVE_DIR"
# Man pagecp "doc/fd.1" "$ARCHIVE_DIR"
# Autocompletion filescp -r autocomplete "${ARCHIVE_DIR}"
# base compressed packagepushd "${staging_dir}/" >/dev/nullcase ${TARGET} in*-pc-windows-*) 7z -y a "${PKG_NAME}" "${ARCHIVE_NAME}"/* | tail -2 ;;*) tar czf "${PKG_NAME}" "${ARCHIVE_NAME}"/* ;;esac;popd >/dev/null
if [[ -n "$GITHUB_OUTPUT" ]]; then echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_OUTPUT # Let subsequent steps know where to find the compressed package echo "PKG_PATH=${PKG_STAGING}/${PKG_NAME}" >> $GITHUB_OUTPUTfimodified:.gitignore+1 added
1 target/2 /autocomplete/3+/package/4 **/*.rs.bkmodified:Makefile+13 added-1 removed
1-PROFILE=release1+PROFILE?=release2 EXE=target/$(PROFILE)/fd3 prefix=/usr/local4 bindir=$(prefix)/bin5 datadir=$(prefix)/share6 exe_name=fd7+ifdef VERSION8+ ARCHIVE_NAME = fd-v$(VERSION)9+else10+ ARCHIVE_NAME = fd11+endif12+export ARCHIVE_NAME13+archive_path=package/$(ARCHIVE_NAME).tar.gz14 15 $(EXE): Cargo.toml src/**/*.rs16 cargo build --profile $(PROFILE) --locked17 29 unmodified lines47 autocomplete/fdfind.fish: contrib/completion/fdfind.fish48 $(comp_dir)49 cp $< $@50 51+archive: $(archive_path)52+53+$(archive_path): completions $(EXE)54+ bash scripts/create-archive.sh55+56 install: $(EXE) completions57 install -Dm755 $(EXE) $(DESTDIR)$(bindir)/fd58 install -Dm644 autocomplete/fd.bash $(DESTDIR)/$(datadir)/bash-completion/completions/$(exe_name)59 install -Dm644 autocomplete/fd.fish $(DESTDIR)/$(datadir)/fish/vendor_completions.d/$(exe_name).fish5 unmodified lines