Skip to content

Commit

Permalink
ci: publish .deb files to packagecloud.io
Browse files Browse the repository at this point in the history
Signed-off-by: Hajime Tazaki <thehajime@gmail.com>
  • Loading branch information
thehajime committed Oct 8, 2021
1 parent ee9d373 commit b342ee2
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 7 deletions.
47 changes: 42 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -237,27 +242,59 @@ 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 }}
prerelease: true
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'
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)


Expand All @@ -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
```
2 changes: 1 addition & 1 deletion pkg/deb/DEBIAN/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Version: __VERSION__
Depends: libc6, jq
Architecture: __ARCH__
Maintainer: Hajime Tazaki <thehajime@gmail.com>
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__)

0 comments on commit b342ee2

Please # to comment.