diff options
author | Martin Nordholts <enselic@gmail.com> | 2021-01-11 19:45:53 +0100 |
---|---|---|
committer | David Peter <sharkdp@users.noreply.github.com> | 2021-01-11 22:18:49 +0100 |
commit | 3dcf02549e373adcb12a0b031e8d17bddd9e204b (patch) | |
tree | 55fb7b199d905fbbd9019637a9f45bca1cf9c43f | |
parent | e402011a735561157b304180810c38bce68f0326 (diff) |
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
-rw-r--r-- | .github/workflows/CICD.yml | 73 |
1 files changed, 35 insertions, 38 deletions
diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 5c805c37..c1dfe088 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -127,27 +127,6 @@ jobs: echo ::set-output name=PKG_NAME::${PKG_NAME} unset IS_RELEASE ; if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true' ; fi 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 # # * test only library unit tests and binary for arm-type targets unset CARGO_TEST_OPTIONS @@ -251,13 +230,31 @@ jobs: esac; popd >/dev/null - name: Debian package + id: debian-package shell: bash - if: steps.vars.outputs.DPKG_NAME + if: startsWith(matrix.job.os, 'ubuntu') run: | COPYRIGHT_YEARS="2018 - "$(date "+%Y") DPKG_DIR="${{ steps.vars.outputs.STAGING }}/dpkg" 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 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 @@ -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 }}" # README and LICENSE - install -Dm644 "README.md" "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/README.md" - install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/LICENSE-MIT" - install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/LICENSE-APACHE" - install -Dm644 "CHANGELOG.md" "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/changelog" - gzip -n --best "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/changelog" + install -Dm644 "README.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/README.md" + install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-MIT" + install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-APACHE" + install -Dm644 "CHANGELOG.md" "${DPKG_DIR}/usr/share/doc/${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/ Upstream-Name: ${{ env.PROJECT_NAME }} Source: ${{ env.PROJECT_HOMEPAGE }} @@ -316,26 +313,26 @@ jobs: IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 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 mkdir -p "${DPKG_DIR}/DEBIAN" cat > "${DPKG_DIR}/DEBIAN/control" <<EOF - Package: ${{ steps.vars.outputs.DPKG_BASENAME }} - Version: ${{ steps.vars.outputs.DPKG_VERSION }} + Package: ${DPKG_BASENAME} + Version: ${DPKG_VERSION} Section: utils Priority: optional Maintainer: ${{ env.PROJECT_MAINTAINER }} Homepage: ${{ env.PROJECT_HOMEPAGE }} - Architecture: ${{ steps.vars.outputs.DPKG_ARCH }} + Architecture: ${DPKG_ARCH} Provides: ${{ env.PROJECT_NAME }} - Conflicts: ${{ steps.vars.outputs.DPKG_CONFLICTS }} + Conflicts: ${DPKG_CONFLICTS} Description: cat(1) clone with wings. A cat(1) clone with syntax highlighting and Git integration. EOF # 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 uses: actions/upload-artifact@master with: @@ -343,17 +340,17 @@ jobs: path: ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }} - name: Upload Debian package artifact uses: actions/upload-artifact@master - if: steps.vars.outputs.DPKG_NAME + if: steps.debian-package.outputs.DPKG_NAME with: - name: ${{ steps.vars.outputs.DPKG_NAME }} - path: ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.DPKG_NAME }} + name: ${{ steps.debian-package.outputs.DPKG_NAME }} + path: ${{ steps.vars.outputs.STAGING }}/${{ steps.debian-package.outputs.DPKG_NAME }} - name: Publish archives and packages uses: softprops/action-gh-release@v1 if: steps.vars.outputs.IS_RELEASE with: files: | ${{ 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: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |