salt/.github/workflows/build-deb-packages.yml

112 lines
3.1 KiB
YAML

---
name: Build Debian Packages
on:
workflow_call:
inputs:
salt-version:
type: string
required: true
description: The Salt version to set prior to building packages.
jobs:
build:
name: DEB
runs-on:
- self-hosted
- linux
- ${{ matrix.arch }}
strategy:
fail-fast: false
matrix:
arch:
- x86_64
- aarch64
src:
- true
- false
container:
image: ghcr.io/saltstack/salt-ci-containers/packaging:debian-11
steps:
# Checkout here so we can easily use custom actions
- uses: actions/checkout@v3
# Checkout here for the build process
- name: Checkout in build directory
uses: actions/checkout@v3
with:
path:
pkgs/checkout/
- name: Download Onedir Tarball as an Artifact
uses: actions/download-artifact@v3
with:
name: salt-${{ inputs.salt-version }}-onedir-linux-${{ matrix.arch }}.tar.xz
path: pkgs/checkout/artifacts/
- name: Download Release Patch
if: ${{ startsWith(github.event.ref, 'refs/tags') == false }}
uses: actions/download-artifact@v3
with:
name: salt-${{ inputs.salt-version }}.patch
path: pkgs/checkout/
- name: Setup Python Tools Scripts
uses: ./.github/actions/setup-python-tools-scripts
with:
cwd: pkgs/checkout/
- name: Setup Salt Version
id: setup-salt-version
uses: ./.github/actions/setup-salt-version
with:
salt-version: "${{ inputs.salt-version }}"
cwd: pkgs/checkout/
- name: Configure Git
if: ${{ startsWith(github.event.ref, 'refs/tags') == false }}
working-directory: pkgs/checkout/
run: |
tools pkg configure-git
- name: Apply release patch
if: ${{ startsWith(github.event.ref, 'refs/tags') == false }}
working-directory: pkgs/checkout/
run: |
tools pkg apply-release-patch salt-${{ inputs.salt-version }}.patch --delete
- name: Build Deb
working-directory: pkgs/checkout/
if: ${{ matrix.src != true}}
run: |
tools pkg build deb --onedir salt-${{ inputs.salt-version }}-onedir-linux-${{ matrix.arch }}.tar.xz
- name: Build Deb
working-directory: pkgs/checkout/
if: ${{ matrix.src == true}}
run: |
tools pkg build deb --arch ${{ matrix.arch }}
- name: Cleanup
run: |
rm -rf pkgs/checkout/
- name: Upload DEBs
uses: actions/upload-artifact@v3
if: ${{ matrix.src == false}}
with:
name: salt-${{ inputs.salt-version }}-${{ matrix.arch }}-deb
path: ${{ github.workspace }}/pkgs/*
retention-days: 7
if-no-files-found: error
- name: Upload DEBs
uses: actions/upload-artifact@v3
if: ${{ matrix.src == true}}
with:
name: salt-${{ inputs.salt-version }}-${{ matrix.arch }}-deb-from-src
path: ${{ github.workspace }}/pkgs/*
retention-days: 7
if-no-files-found: error