8000 More info · trikko/trovatore@83b68f2 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

More info

More info #36

Workflow file for this run

name: Build Trovatore (linux-static)
on:
push:
branches:
- main
tags:
- 'v*'
jobs:
build-and-export:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v4
# Set up Docker build
- name: Build Docker image
run: |
echo "commit: ${GITHUB_SHA::7}" > version
# Add version info if this is a release
- name: Set version info for release
if: startsWith(github.ref, 'refs/tags/')
run: |
VERSION=$(echo ${{ github.ref }} | sed 's/refs\/tags\///')
echo "$VERSION" > version
- name: Build static
run: |
echo "FROM alpine:latest
RUN apk add vim gcc musl-dev ldc dub llvm-libunwind-static openssl-libs-static gzip upx cmake make
WORKDIR /app
COPY . .
CMD [\"dub\", \"build\", \"--build=release\", \"--config=trovatore-static\"]" > Dockerfile
docker build -t trovatore-image .
# Run the Docker container to build the project
- name: Run Docker container and build project
run: |
docker run --name trovatore-container trovatore-image || true
# Copy compiled file from Docker container to host
- name: Copy compiled binary
run: |
docker cp trovatore-container:/app/trovatore .
docker rm trovatore-container
strip -s trovatore
- name: Create deb package
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
VERSION=$(echo ${{ github.ref }} | sed 's/refs\/tags\/v*//')
else
VERSION="0.0.0-dev"
fi
echo "Creating deb package for version $VERSION"
mkdir -p trovatore-$VERSION/DEBIAN
mkdir -p trovatore-$VERSION/usr/bin
mkdir -p trovatore-$VERSION/usr/share/doc/trovatore
echo "Package: trovatore" > trovatore-$VERSION/DEBIAN/control
echo "Version: $VERSION" >> trovatore-$VERSION/DEBIAN/control
echo "Section: web" >> trovatore-$VERSION/DEBIAN/control
echo "Priority: optional" >> trovatore-$VERSION/DEBIAN/control
echo "Architecture: amd64" >> trovatore-$VERSION/DEBIAN/control
echo "Maintainer: Andrea Fontana <me@andreafontana.it>" >> trovatore-$VERSION/DEBIAN/control
echo "Description: A fast command-line tool for searching files by name." >> trovatore-$VERSION/DEBIAN/control
cp trovatore trovatore-$VERSION/usr/bin/
cp LICENSE trovatore-$VERSION/usr/share/doc/trovatore/
cp README.md trovatore-$VERSION/usr/share/doc/trovatore/
echo "#!/bin/bash" > trovatore-$VERSION/DEBIAN/postinst
echo "chmod +x /usr/bin/trovatore" >> trovatore-$VERSION/DEBIAN/postinst
chmod +x trovatore-$VERSION/DEBIAN/postinst
dpkg-deb --build trovatore-$VERSION
rm -rf trovatore-$VERSION/*
mv trovatore-$VERSION.deb trovatore.deb
# Upload the binary as an artifact
- name: Upload binary as artifact
uses: actions/upload-artifact@v4
with:
name: trovatore
path: trovatore
# Upload the deb package as an artifact
- name: Upload deb package as artifact
uses: actions/upload-artifact@v4
with:
name: trovatore.deb
path: trovatore.deb
- name: Pull latest changes
run: |
git checkout -- version
git fetch origin
git checkout gh-pages
git pull origin gh-pages
# Prepara la directory per GitHub Pages
- name: Prepara directory per GitHub Pages
if: startsWith(github.ref, 'refs/tags/v')
run: |
mkdir -p public/linux
cp trovatore.deb public/linux/trovatore.deb
cp trovatore public/linux/
# Pubblica su GitHub Pages
- name: Deploy su GitHub Pages
if: startsWith(github.ref, 'refs/tags/v')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
force_orphan: false
keep_files: true
0