Skip to content

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

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

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

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 && mkdir -p /home/builder/project && chown -R builder:builder /home/builder/project\nUSER builder\nCOPY . /home/builder/project\nWORKDIR /home/builder/project\nRUN chmod -R 777 /home/builder/project && 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/project/dist/phase '\$pkgdir'/usr/bin/phase\n}\n\ncheck() {\n return 0\n}\n\nsha512sums=''" > APKBUILD
docker build -t alpine-build .
docker run -v $PWD:/home/builder/project alpine-build /bin/sh -c "mkdir /home/builder/builddir && 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/*