mirror of
https://github.com/sharkdp/bat.git
synced 2025-04-18 16:50:33 +01:00
CICD: Build: Move DPKG_* vars to 'Debian package' step
For cleaner CICD script. Note that we can't use outputs defined in our own step, so also change to shell vars intead. For #1474
This commit is contained in:
parent
e402011a73
commit
3dcf02549e
73
.github/workflows/CICD.yml
vendored
73
.github/workflows/CICD.yml
vendored
@ -127,27 +127,6 @@ jobs:
|
|||||||
echo ::set-output name=PKG_NAME::${PKG_NAME}
|
echo ::set-output name=PKG_NAME::${PKG_NAME}
|
||||||
unset IS_RELEASE ; if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true' ; fi
|
unset IS_RELEASE ; if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true' ; fi
|
||||||
echo ::set-output name=IS_RELEASE::${IS_RELEASE}
|
echo ::set-output name=IS_RELEASE::${IS_RELEASE}
|
||||||
# DPKG architecture?
|
|
||||||
unset DPKG_ARCH
|
|
||||||
case ${{ matrix.job.target }} in
|
|
||||||
aarch64-*-linux-*) DPKG_ARCH=arm64 ;;
|
|
||||||
arm-*-linux-*hf) DPKG_ARCH=armhf ;;
|
|
||||||
i686-*-linux-*) DPKG_ARCH=i686 ;;
|
|
||||||
x86_64-*-linux-*) DPKG_ARCH=amd64 ;;
|
|
||||||
esac;
|
|
||||||
echo ::set-output name=DPKG_ARCH::${DPKG_ARCH}
|
|
||||||
DPKG_VERSION=${PROJECT_VERSION}
|
|
||||||
echo ::set-output name=DPKG_VERSION::${DPKG_VERSION}
|
|
||||||
# DPKG base name/conflicts?
|
|
||||||
DPKG_BASENAME=${PROJECT_NAME}
|
|
||||||
DPKG_CONFLICTS=${PROJECT_NAME}-musl
|
|
||||||
case ${{ matrix.job.target }} in *-musl) DPKG_BASENAME=${PROJECT_NAME}-musl ; DPKG_CONFLICTS=${PROJECT_NAME} ;; esac;
|
|
||||||
echo ::set-output name=DPKG_BASENAME::${DPKG_BASENAME}
|
|
||||||
echo ::set-output name=DPKG_CONFLICTS::${DPKG_CONFLICTS}
|
|
||||||
# DPKG name
|
|
||||||
unset DPKG_NAME;
|
|
||||||
if [[ -n $DPKG_ARCH && -n $DPKG_VERSION ]]; then DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb" ; fi
|
|
||||||
echo ::set-output name=DPKG_NAME::${DPKG_NAME}
|
|
||||||
# target-specific options
|
# target-specific options
|
||||||
# # * test only library unit tests and binary for arm-type targets
|
# # * test only library unit tests and binary for arm-type targets
|
||||||
unset CARGO_TEST_OPTIONS
|
unset CARGO_TEST_OPTIONS
|
||||||
@ -251,13 +230,31 @@ jobs:
|
|||||||
esac;
|
esac;
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
- name: Debian package
|
- name: Debian package
|
||||||
|
id: debian-package
|
||||||
shell: bash
|
shell: bash
|
||||||
if: steps.vars.outputs.DPKG_NAME
|
if: startsWith(matrix.job.os, 'ubuntu')
|
||||||
run: |
|
run: |
|
||||||
COPYRIGHT_YEARS="2018 - "$(date "+%Y")
|
COPYRIGHT_YEARS="2018 - "$(date "+%Y")
|
||||||
DPKG_DIR="${{ steps.vars.outputs.STAGING }}/dpkg"
|
DPKG_DIR="${{ steps.vars.outputs.STAGING }}/dpkg"
|
||||||
mkdir -p "${DPKG_DIR}"
|
mkdir -p "${DPKG_DIR}"
|
||||||
|
|
||||||
|
DPKG_BASENAME=${PROJECT_NAME}
|
||||||
|
DPKG_CONFLICTS=${PROJECT_NAME}-musl
|
||||||
|
case ${{ matrix.job.target }} in *-musl) DPKG_BASENAME=${PROJECT_NAME}-musl ; DPKG_CONFLICTS=${PROJECT_NAME} ;; esac;
|
||||||
|
DPKG_VERSION=${PROJECT_VERSION}
|
||||||
|
|
||||||
|
unset DPKG_ARCH
|
||||||
|
case ${{ matrix.job.target }} in
|
||||||
|
aarch64-*-linux-*) DPKG_ARCH=arm64 ;;
|
||||||
|
arm-*-linux-*hf) DPKG_ARCH=armhf ;;
|
||||||
|
i686-*-linux-*) DPKG_ARCH=i686 ;;
|
||||||
|
x86_64-*-linux-*) DPKG_ARCH=amd64 ;;
|
||||||
|
*) DPKG_ARCH=notset ;;
|
||||||
|
esac;
|
||||||
|
|
||||||
|
DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb"
|
||||||
|
echo ::set-output name=DPKG_NAME::${DPKG_NAME}
|
||||||
|
|
||||||
# Binary
|
# Binary
|
||||||
install -Dm755 'target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}' "${DPKG_DIR}/usr/bin/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}"
|
install -Dm755 'target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}' "${DPKG_DIR}/usr/bin/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}"
|
||||||
if [ -n "${{ steps.vars.outputs.STRIP }}" ]; then "${{ steps.vars.outputs.STRIP }}" "${DPKG_DIR}/usr/bin/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}" ; fi
|
if [ -n "${{ steps.vars.outputs.STRIP }}" ]; then "${{ steps.vars.outputs.STRIP }}" "${DPKG_DIR}/usr/bin/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}" ; fi
|
||||||
@ -271,13 +268,13 @@ jobs:
|
|||||||
install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.zsh "${DPKG_DIR}/usr/share/zsh/vendor-completions/_${{ env.PROJECT_NAME }}"
|
install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.zsh "${DPKG_DIR}/usr/share/zsh/vendor-completions/_${{ env.PROJECT_NAME }}"
|
||||||
|
|
||||||
# README and LICENSE
|
# README and LICENSE
|
||||||
install -Dm644 "README.md" "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/README.md"
|
install -Dm644 "README.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/README.md"
|
||||||
install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/LICENSE-MIT"
|
install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-MIT"
|
||||||
install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/LICENSE-APACHE"
|
install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-APACHE"
|
||||||
install -Dm644 "CHANGELOG.md" "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/changelog"
|
install -Dm644 "CHANGELOG.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog"
|
||||||
gzip -n --best "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/changelog"
|
gzip -n --best "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog"
|
||||||
|
|
||||||
cat > "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/copyright" <<EOF
|
cat > "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/copyright" <<EOF
|
||||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
Upstream-Name: ${{ env.PROJECT_NAME }}
|
Upstream-Name: ${{ env.PROJECT_NAME }}
|
||||||
Source: ${{ env.PROJECT_HOMEPAGE }}
|
Source: ${{ env.PROJECT_HOMEPAGE }}
|
||||||
@ -316,26 +313,26 @@ jobs:
|
|||||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
DEALINGS IN THE SOFTWARE.
|
DEALINGS IN THE SOFTWARE.
|
||||||
EOF
|
EOF
|
||||||
chmod 644 "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/copyright"
|
chmod 644 "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/copyright"
|
||||||
|
|
||||||
# control file
|
# control file
|
||||||
mkdir -p "${DPKG_DIR}/DEBIAN"
|
mkdir -p "${DPKG_DIR}/DEBIAN"
|
||||||
cat > "${DPKG_DIR}/DEBIAN/control" <<EOF
|
cat > "${DPKG_DIR}/DEBIAN/control" <<EOF
|
||||||
Package: ${{ steps.vars.outputs.DPKG_BASENAME }}
|
Package: ${DPKG_BASENAME}
|
||||||
Version: ${{ steps.vars.outputs.DPKG_VERSION }}
|
Version: ${DPKG_VERSION}
|
||||||
Section: utils
|
Section: utils
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: ${{ env.PROJECT_MAINTAINER }}
|
Maintainer: ${{ env.PROJECT_MAINTAINER }}
|
||||||
Homepage: ${{ env.PROJECT_HOMEPAGE }}
|
Homepage: ${{ env.PROJECT_HOMEPAGE }}
|
||||||
Architecture: ${{ steps.vars.outputs.DPKG_ARCH }}
|
Architecture: ${DPKG_ARCH}
|
||||||
Provides: ${{ env.PROJECT_NAME }}
|
Provides: ${{ env.PROJECT_NAME }}
|
||||||
Conflicts: ${{ steps.vars.outputs.DPKG_CONFLICTS }}
|
Conflicts: ${DPKG_CONFLICTS}
|
||||||
Description: cat(1) clone with wings.
|
Description: cat(1) clone with wings.
|
||||||
A cat(1) clone with syntax highlighting and Git integration.
|
A cat(1) clone with syntax highlighting and Git integration.
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# build dpkg
|
# build dpkg
|
||||||
fakeroot dpkg-deb --build "${DPKG_DIR}" "${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.DPKG_NAME }}"
|
fakeroot dpkg-deb --build "${DPKG_DIR}" "${{ steps.vars.outputs.STAGING }}/${DPKG_NAME}"
|
||||||
- name: Upload package artifact
|
- name: Upload package artifact
|
||||||
uses: actions/upload-artifact@master
|
uses: actions/upload-artifact@master
|
||||||
with:
|
with:
|
||||||
@ -343,17 +340,17 @@ jobs:
|
|||||||
path: ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
|
path: ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
|
||||||
- name: Upload Debian package artifact
|
- name: Upload Debian package artifact
|
||||||
uses: actions/upload-artifact@master
|
uses: actions/upload-artifact@master
|
||||||
if: steps.vars.outputs.DPKG_NAME
|
if: steps.debian-package.outputs.DPKG_NAME
|
||||||
with:
|
with:
|
||||||
name: ${{ steps.vars.outputs.DPKG_NAME }}
|
name: ${{ steps.debian-package.outputs.DPKG_NAME }}
|
||||||
path: ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.DPKG_NAME }}
|
path: ${{ steps.vars.outputs.STAGING }}/${{ steps.debian-package.outputs.DPKG_NAME }}
|
||||||
- name: Publish archives and packages
|
- name: Publish archives and packages
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: steps.vars.outputs.IS_RELEASE
|
if: steps.vars.outputs.IS_RELEASE
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
|
${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
|
||||||
${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.DPKG_NAME }}
|
${{ steps.vars.outputs.STAGING }}/${{ steps.debian-package.outputs.DPKG_NAME }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user