From b342ee2e989e5c2d05710886c56187687f9a8eef Mon Sep 17 00:00:00 2001 From: Hajime Tazaki Date: Fri, 8 Oct 2021 13:30:14 +0900 Subject: [PATCH] ci: publish .deb files to packagecloud.io Signed-off-by: Hajime Tazaki --- .github/workflows/ci.yml | 47 +++++++++++++++++++++++++++++++++++----- README.md | 11 +++++++++- pkg/deb/DEBIAN/control | 2 +- 3 files changed, 53 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f82553a..6b40e24 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,10 +100,15 @@ jobs: echo "$HOME/.local/bin:${{ github.workspace }}/bin" >> $GITHUB_PATH echo "export PATH=$HOME/.local/bin:${{ github.workspace }}/bin:$PATH" >> $HOME/.bashrc RELEASE_VERSION=`git describe --tags --abbrev=0 | sed "s/^v//"` - BUILD_VERSION=${RELEASE_VERSION}.${{ github.run_number }} - PACKAGE_FILENAME=docker-runu-$BUILD_VERSION-${{ matrix.arch_alias }}.deb + if [ `git rev-list -n 1 v"$RELEASE_VERSION"` == `git rev-list -n 1 HEAD` ] ; then + BUILD_VERSION=${RELEASE_VERSION} + else + BUILD_VERSION=${RELEASE_VERSION}-next + fi + PACKAGE_FILENAME=docker-runu_${BUILD_VERSION}_${{ matrix.arch_alias }}.deb echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV echo "BUILD_VERSION=$BUILD_VERSION" >> $GITHUB_ENV + echo "BUILD_DATE="`date "+%Y%m%d"` >> $GITHUB_ENV echo "PACKAGE_FILENAME=$PACKAGE_FILENAME" >> $GITHUB_ENV echo "DEB_ARCH=${{ matrix.arch_alias }}" >> $GITHUB_ENV # image version @@ -237,20 +242,26 @@ jobs: if: runner.os == 'linux' run: | bash -ex pkg/pre-deploy-deb.sh + - name: Verify Debian package + if: runner.os == 'linux' + run: | + dpkg --info *.deb + dpkg --contents *.deb - name: Test Debian package if: runner.os == 'linux' && matrix.arch == 'amd64' run: | bash -ex pkg/pre-deploy-test-deb.sh - name: upload artifact + if: runner.os == 'linux' uses: actions/upload-artifact@v2 with: path: ${{ env.PACKAGE_FILENAME }} name: ${{ env.PACKAGE_FILENAME }} - # TODO: use appropriate debian repository instead of github release - - name: Release - if: gitHub.event_name == 'release' + # TODO: prepare homebrew bottle + - name: Github Releases + if: runner.os == 'linux' && gitHub.event_name == 'release' uses: softprops/action-gh-release@v1 with: tag_name: v${{ env.RELEASE_VERSION }} @@ -258,6 +269,32 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} files: | ${{ env.PACKAGE_FILENAME }} + - uses: actions/setup-ruby@v1 + with: + ruby-version: 2.5 + - name: Release to packagecloud.io + if: runner.os == 'linux' && gitHub.event_name == 'release' + run: | + # Instsall packagecloud CLI + gem install package_cloud + # push all versions and delete it in advance + for distro_version in ${{ env.DISTRO_LIST }} ; do + package_cloud yank ukontainer/runu/$distro_version ${{ env.PACKAGE_FILENAME }} || true + package_cloud push ukontainer/runu/$distro_version ${{ env.PACKAGE_FILENAME }} + done + env: + PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }} + DISTRO_LIST: "ubuntu/xenial ubuntu/bionic ubuntu/focal" + - name: Test Released Debian package + if: runner.os == 'linux' && matrix.arch == 'amd64' + run: | + sudo apt-get remove docker-runu + #set -x + # wait for complete indexing at pkgcloud + sleep 60 + curl -s https://packagecloud.io/install/repositories/ukontainer/runu/script.deb.sh | sudo bash + sudo apt-get install docker-runu + docker run --rm -i --runtime=runu-dev alpine uname -a - name: Log in to docker.io if: runner.os == 'linux' diff --git a/README.md b/README.md index 849e5a2..b06d452 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/ukontainer/runu.svg?branch=master)](https://travis-ci.org/ukontainer/runu) +[![CI](https://github.com/ukontainer/runu/actions/workflows/ci.yml/badge.svg)](https://github.com/ukontainer/runu/actions/workflows/ci.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/libos-nuse/runu)](https://goreportcard.com/report/github.com/libos-nuse/runu) @@ -21,3 +21,12 @@ add an entry to `/etc/docker/daemon.json` ] }, ``` + +Optionally, you can install debian package from the repository. + +``` +# register apt repository +curl -s https://packagecloud.io/install/repositories/ukontainer/runu/script.deb.sh | sudo bash +# install the package +sudo apt-get install docker-runu +``` \ No newline at end of file diff --git a/pkg/deb/DEBIAN/control b/pkg/deb/DEBIAN/control index 67d581a..e14396b 100644 --- a/pkg/deb/DEBIAN/control +++ b/pkg/deb/DEBIAN/control @@ -3,4 +3,4 @@ Version: __VERSION__ Depends: libc6, jq Architecture: __ARCH__ Maintainer: Hajime Tazaki -Description: runu OCI runtime for docker with upload to Bintray repository using Travis CI (Build date: __DATE__) +Description: runu OCI runtime for docker (Build date: __DATE__)