release v1.2.0 #66
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build a Debian package | |
on: | |
push: | |
branches: | |
- "**" | |
tags: | |
- "v*" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build-deb: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
os: ["debian", "raspios"] | |
include: | |
- os: debian | |
dist: bullseye | |
arch: amd64 | |
keyring_cmd: sudo apt-get install -y debian-archive-keyring | |
- os: raspios | |
dist: bullseye | |
arch: armhf | |
keyring_cmd: wget http://archive.raspbian.org/raspbian/pool/main/r/raspbian-archive-keyring/raspbian-archive-keyring_20120528.2_all.deb && sudo dpkg -i raspbian-archive-keyring_20120528.2_all.deb | |
defaults: | |
run: | |
working-directory: backend | |
name: Build a Debian package for ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Update apt cache | |
run: | | |
sudo apt-get update | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
cache: "pipenv" | |
cache-dependency-path: backend/Pipfile.lock | |
- name: Install pipenv | |
run: | | |
python -m pip install --upgrade pip pipenv | |
python --version; python -m pip --version; pipenv --version | |
- name: Setup backend project with pipenv | |
run: | | |
pipenv --python 3.9 install --dev | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: "npm" | |
cache-dependency-path: frontend/smartmeter-datacollector-configurator/package-lock.json | |
- name: Setup frontend project with npm | |
working-directory: frontend/smartmeter-datacollector-configurator | |
run: | | |
npm ci --ignore-scripts | |
- name: Prepare to build a Debian source package | |
run: | | |
sudo apt-get -y install python3-all debhelper dh-python rename | |
- name: Build a Debian source package | |
run: | | |
pipenv run build_srcdeb | |
- name: Cache pbuilder chroot | |
id: cache-pbuilder-chroot | |
uses: actions/cache@v3 | |
with: | |
path: /var/cache/pbuilder/${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}-base.tgz | |
key: ${{ runner.os }}-pbuilder-${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}-${{ hashFiles('**/Pipfile.lock') }} | |
- name: Prepare the pbuilder chroot for ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }} | |
if: steps.cache-pbuilder-${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}-chroot.outputs.cache-hit != 'true' | |
run: | | |
sudo apt-get install -y pbuilder qemu-user-static | |
${{ matrix.keyring_cmd }} | |
sudo cp scripts/.pbuilderrc /root/ | |
sudo mkdir -p /var/cache/pbuilder/${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}/aptcache/ | |
sudo OS=${{ matrix.os }} DIST=${{ matrix.dist }} ARCH=${{ matrix.arch }} pbuilder --create | |
- name: Build the Debian package for ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }} using pbuilder | |
run: | | |
cd deb_dist | |
sudo OS=${{ matrix.os }} DIST=${{ matrix.dist }} ARCH=${{ matrix.arch }} pbuilder update | |
sudo OS=${{ matrix.os }} DIST=${{ matrix.dist }} ARCH=${{ matrix.arch }} pbuilder build *.dsc | |
sudo rename "s/_all\./_${{ matrix.arch }}\./" /var/cache/pbuilder/${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}/result/*.deb | |
- name: Archive the built Debian package for ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}-deb | |
path: /var/cache/pbuilder/${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}/result/*.deb | |
- name: Archive the additional Debian package files for ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}-packagefiles | |
path: | | |
/var/cache/pbuilder/${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}/result/*.dsc | |
/var/cache/pbuilder/${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}/result/*.tar.* | |
- name: Get the tag name | |
id: tag-name | |
if: startsWith(github.ref, 'refs/tags') | |
uses: olegtarasov/[email protected] | |
- name: Create a new release | |
if: startsWith(github.ref, 'refs/tags') | |
uses: ncipollo/[email protected] | |
with: | |
allowUpdates: true | |
artifacts: /var/cache/pbuilder/${{ matrix.os }}-${{ matrix.dist }}-${{ matrix.arch }}/result/*.deb | |
draft: true | |
name: Smart Meter Data Collector Configurator ${{ steps.tag-name.outputs.tag }} | |
omitBody: true | |
omitBodyDuringUpdate: true | |
omitNameDuringUpdate: true | |
omitPrereleaseDuringUpdate: true | |
token: ${{ secrets.GITHUB_TOKEN }} |