Picocrypt/.github/workflows/build-linux.yml

93 lines
2.3 KiB
YAML

name: build-linux
permissions:
contents: write
on:
push:
paths:
- "VERSION"
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-24.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: v1
- 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
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
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: Generate checksums
run: |
echo "CHECKSUM_PICOCRYPT=$(sha256sum Picocrypt | cut -d ' ' -f1)" >> $GITHUB_ENV
echo "CHECKSUM_DEB=$(sha256sum Picocrypt.deb | cut -d ' ' -f1)" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
Picocrypt
Picocrypt.deb
tag_name: ${{ env.VERSION }}
make_latest: true
append_body: true
body: |
**Linux:**
`sha256(Picocrypt) ${{ env.CHECKSUM_PICOCRYPT }}`
`sha256(Picocrypt.deb) ${{ env.CHECKSUM_DEB }}`