Picocrypt/.github/workflows/build-linux.yml
2024-07-08 23:08:40 -04:00

85 lines
2 KiB
YAML

name: build-linux
permissions:
contents: write
on:
push:
paths:
- "VERSION"
branches:
- main
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '>1.18'
check-latest: true
cache: false
- name: Install packages
run: |
sudo apt install -y gcc xorg-dev libgtk-3-dev libgl1-mesa-dev libglu1-mesa wget
- name: Install dependencies
run: |
cd src
go mod download
- name: Build
run: |
cd src
go build -v -ldflags="-s -w" -o Picocrypt Picocrypt.go
env:
CGO_ENABLED: 1
GOAMD64: v2
- name: Set .deb version
run: |
VERSION=$(cat VERSION)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Version: $VERSION" >> Picocrypt/Picocrypt/DEBIAN/control
echo "Version=$VERSION" >> Picocrypt/Picocrypt/usr/share/applications/picocrypt.desktop
- name: Package as .deb
run: |
wget https://github.com/user-attachments/files/16136712/Picocrypt.zip
python -m zipfile -e Picocrypt.zip Picocrypt
cp src/Picocrypt Picocrypt/Picocrypt/usr/bin/picocrypt-gui
cd Picocrypt
dpkg-deb -Zxz --build --root-owner-group Picocrypt
- name: Prepare to upload artifacts
run: |
mkdir out
mv src/Picocrypt out
mv Picocrypt/Picocrypt.deb out
rm -rf src
rm -rf Picocrypt
mv out/Picocrypt .
mv out/Picocrypt.deb .
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build-linux
path: |
Picocrypt
Picocrypt.deb
if-no-files-found: error
compression-level: 9
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
Picocrypt
Picocrypt.deb
tag_name: ${{ env.VERSION }}
make_latest: true