96 lines
2.8 KiB
YAML
96 lines
2.8 KiB
YAML
name: Build and Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
release:
|
|
types: [created]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Zig
|
|
uses: mlugg/setup-zig@v2
|
|
with:
|
|
version: 0.14.0
|
|
|
|
- name: Clone pikabar source
|
|
run: |
|
|
git clone https://git.pika-os.com/wm-packages/pikabar.git
|
|
|
|
- name: Create Programs directory
|
|
run: mkdir -p ${{ github.workspace }}/Programs
|
|
|
|
- name: Build zigstat
|
|
run: |
|
|
cd pikabar/src/zigstat
|
|
zig build-exe src/main.zig -O ReleaseSmall -mcpu x86_64_v2 --name zigstat
|
|
mv zigstat ${{ github.workspace }}/Programs/
|
|
|
|
- name: Build zigbrightness
|
|
run: |
|
|
cd pikabar/src/zigbrightness
|
|
zig build-exe src/main.zig -O ReleaseSmall -mcpu x86_64_v2 --name zigbrightness
|
|
mv zigbrightness ${{ github.workspace }}/Programs/
|
|
|
|
- name: Create release archive
|
|
run: |
|
|
# Create a clean output directory
|
|
mkdir -p ../noctalia-release
|
|
|
|
# Copy all files except .git, .github, and pikabar
|
|
cp -r . ../noctalia-release/
|
|
rm -rf ../noctalia-release/.git
|
|
rm -rf ../noctalia-release/.github
|
|
rm -rf ../noctalia-release/pikabar
|
|
|
|
# Create the archives
|
|
cd ..
|
|
tar -czf noctalia-${{ github.ref_name }}.tar.gz noctalia-release/
|
|
cp noctalia-${{ github.ref_name }}.tar.gz noctalia-latest.tar.gz
|
|
|
|
# Move archives to workspace
|
|
mv *.tar.gz ${{ github.workspace }}/
|
|
|
|
- name: Upload Release Asset
|
|
if: github.event_name == 'release'
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ github.event.release.upload_url }}
|
|
asset_path: ./noctalia-${{ github.ref_name }}.tar.gz
|
|
asset_name: noctalia-${{ github.ref_name }}.tar.gz
|
|
asset_content_type: application/gzip
|
|
|
|
- name: Upload Latest Release Asset
|
|
if: github.event_name == 'release'
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ github.event.release.upload_url }}
|
|
asset_path: ./noctalia-latest.tar.gz
|
|
asset_name: noctalia-latest.tar.gz
|
|
asset_content_type: application/gzip
|
|
|
|
- name: Create Release
|
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: |
|
|
noctalia-${{ github.ref_name }}.tar.gz
|
|
noctalia-latest.tar.gz
|
|
generate_release_notes: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|