ci: add workflow
All checks were successful
Build static mosh deb / build (push) Successful in 5m42s

This commit is contained in:
Dmitry Belyaev 2023-11-01 14:06:41 +03:00
parent 63fb611ece
commit e6db608e68

View File

@ -0,0 +1,73 @@
name: Build static mosh deb
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup docker
run: |
export DEBIAN_FRONTEND=noninteractive
# Add Docker's official GPG key:
apt-get update
apt-get install --no-install-recommends --no-install-suggests ca-certificates curl gnupg apt-transport-https
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
# Add the repository to Apt sources:
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install --no-install-recommends --no-install-suggests docker-ce-cli docker-buildx-plugin docker-compose-plugin
- name: Check out repository code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
#- name: Cache Docker layers
# uses: actions/cache@v3
# with:
# path: /tmp/.buildx-cache
# key: ${{ runner.os }}-buildx-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-buildx-
- name: Build image
uses: docker/build-push-action@v4
with:
context: .
push: false
load: true # automatically load the single-platform build result to docker images
#env:
# ACTIONS_RUNTIME_TOKEN: ""
tags: tmp/mosh-build
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
#- name: Move cache
# run: |
# rm -rf /tmp/.buildx-cache
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Extract packages from image
run: |
mkdir -p ./out
docker run --rm tmp/mosh-build sh -c "tar cf - --strip-components 1 ../mosh_*.deb" | tar vx -C ./out
ls -lh ./out
mv ./out/mosh_*.deb ./out/mosh_static_amd64.deb
- name: Upload packages
uses: actions/upload-artifact@v3
with:
name: mosh_static_amd64.deb
path: ./out/mosh_static_amd64.deb
if-no-files-found: error