Skip to content

fix artifact tarring again #11

fix artifact tarring again

fix artifact tarring again #11

Workflow file for this run

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: package
"on":
push:
paths:
- .github/actions/**
- .github/workflows/package.yml
- debian/**
release:
types: [published]
workflow_dispatch:
inputs:
release:
description: 'Debian package release number'
default: '1'
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
RUST_BACKTRACE: full
# Most docker images seem to get this right but not ubuntu:focal
DEBIAN_FRONTEND: noninteractive
# Use zstd maximum compression for versions of dpkg which support it.
#
# Note that dpkg only checks these environment variables after version 1.21.10
DPKG_DEB_COMPRESSOR_TYPE: zstd
DPKG_DEB_COMPRESSOR_LEVEL: 22
jobs:
build-deb:
name: ${{ matrix.distro }}
runs-on: ubuntu-latest
container: ${{ matrix.distro }}
strategy:
matrix:
distro:
# - debian:buster # oldstable
# - debian:bullseye # stable
- debian:bookworm # testing
# - ubuntu:trusty # LTS until Apr 2024
# - ubuntu:xenial # LTS until Apr 2026
# - ubuntu:bionic # LTS until Apr 2028
# - ubuntu:focal # LTS until Apr 2030
# - ubuntu:jammy # LTS until Apr 2032
# - ubuntu:kinetic # Previous release
# - ubuntu:lunar # Current release
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: setup some variables
id: vars
shell: bash
run: |
echo distro="$(echo '${{ matrix.distro }}' | cut -d : -f 1)" >> "$GITHUB_OUTPUT"
echo release="$(echo '${{ matrix.distro }}' | cut -d : -f 2)" >> "$GITHUB_OUTPUT"
- name: Install apt dependencies
shell: bash
run: |
apt-get update
apt-get install -y curl build-essential pkg-config libssl-dev jq debhelper lsb-release \
cmake libclang-dev protobuf-compiler
- name: install rust
shell: bash
run: |
curl https://static.rust-lang.org/rustup/rustup-init.sh -o rustup-init.sh
chmod +x rustup-init.sh
./rustup-init.sh -y
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
rm -f rustup-init.sh
- name: check cargo
shell: bash
run: |
echo "::group::rustc -vV"
rustc -vV
echo "::endgroup::"
echo "::group::cargo -vV"
cargo -vV
echo "::endgroup::"
- name: set release env var
if: ${{ github.event_name == 'workflow_dispatch' }}
shell: bash
run: |
echo 'RELEASE=${{ github.event.inputs.release }}' >> $GITHUB_ENV
- name: generate changelog
shell: bash
run: ./debian/gen-changelog.sh > debian/changelog
- name: build debs
shell: bash
run: dpkg-buildpackage -b -us -uc
- name: copy debs
shell: bash
run: |
set -x
shopt -s nullglob
mkdir -p target/debian
cp ../*.deb ../*.ddeb target/debian/
cd target/debian
tar cJf ../${{ steps.vars.outputs.distro }}_${{ steps.vars.outputs.release}}.tar.xz *
- uses: actions/upload-artifact@v3
with:
name: ${{ steps.vars.outputs.distro }}_${{ steps.vars.outputs.release }}.tar.xz
path: target/${{ steps.vars.outputs.distro }}_${{ steps.vars.outputs.release }}.tar.xz
upload-to-apt-repo:
# if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
needs:
- build-deb
steps:
- uses: actions/checkout@v3
- uses: google-github-actions/auth@v1
id: auth
with:
credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
- uses: google-github-actions/setup-gcloud@v1
- uses: actions/download-artifact@v3
with:
path: target/debian/
- name: configure artifact registry
run: |
gcloud config set artifacts/repository systemslab
gcloud config set artifacts/location us
- name: upload package
run: |
set -x
for artifact in target/debian/**/*.tar.xz; do
name="$(basename "$artifact")"
distro="$( echo "$name" | cut -d . -f 1 | cut -d _ -f 1)"
release="$(echo "$name" | cut -d . -f 1 | cut -d _ -f 2)"
echo "::group::upload $release $name"
mkdir -p target/artifacts
cd target/artifacts
tar xvf "$artifact"
ls -lah
cd -
for package in target/artifacts/*; do
echo gcloud artifacts apt upload "$release" --source "$package"
done
rm -rf target/artifacts
echo "::endgroup::"
done