Skip to content

feat: added linux builds ( .deb, .rpm) #47

feat: added linux builds ( .deb, .rpm)

feat: added linux builds ( .deb, .rpm) #47

Workflow file for this run

name: PyInstaller Build
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.11]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install -r requirements.txt
- name: Install PyInstaller
run: pip install pyinstaller
- name: Build with PyInstaller
run: pyinstaller --onefile --name phase phase-cli.py
- name: Extract version
run: |
export LC_ALL=C.UTF-8
echo "PHASE_CLI_VERSION=$(grep -oP '(?<=__version__ = ")[^"]*' phase-cli.py)" >> $GITHUB_ENV
- name: Install FPM
run: |
if [ "${{ runner.os }}" == "Linux" ]; then
sudo apt-get install -y ruby-dev rubygems build-essential && sudo gem install --no-document fpm
fpm -s dir -t deb -n phase -v $PHASE_CLI_VERSION dist/phase=/
fpm -s dir -t rpm -n phase -v $PHASE_CLI_VERSION dist/phase=/
fi
- name: Install Docker
run: |
if [ "${{ runner.os }}" == "Linux" ]; then
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
echo -e "FROM alpine:latest\nRUN apk add -U alpine-sdk && adduser -D builder && addgroup builder abuild\nUSER builder\nCOPY . /home/builder\nWORKDIR /home/builder\nRUN cat APKBUILD" > Dockerfile
echo -e "# Maintainer: Phase <[email protected]>\npkgname=phase\npkgver=$PHASE_CLI_VERSION\npkgrel=0\npkgdesc='A cli to manage .env secrets with Phase'\nurl='https://phase.dev'\narch='all'\nlicense='GPL 3.0'\ndepends=''\nmakedepends=''\ninstall=''\nsubpackages=''\n\nbuilddir='/home/builder/builddir'\n\nprepare() {\n return 0\n}\n\nbuild() {\n return 0\n}\n\npackage() {\n install -Dm755 /home/builder/dist/phase '\$pkgdir'/usr/bin/phase\n}\n\ncheck() {\n return 0\n}\n\nsha512sums=''" > APKBUILD
docker build -t alpine-build .
docker run -u root -v $PWD:/home/builder alpine-build /bin/sh -c "mkdir -p /home/builder/.abuild && chown builder:abuild /home/builder/.abuild && su builder -c 'abuild-keygen -a -n && abuild -r'"
mv /home/builder/packages/home/builder/packages/src/*.apk .
fi
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: phase-package
path: |
*.deb
*.rpm
*.apk
dist/*