58 lines
1.4 KiB
YAML
58 lines
1.4 KiB
YAML
name: Build and Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- "v*"
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
|
|
runs-on: ubuntu-latest
|
|
container: debian:11
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install build dependencies
|
|
run: apt-get update && apt-get install -y --no-install-recommends make g++ git tar ca-certificates
|
|
|
|
- name: Build
|
|
run: make clean build
|
|
|
|
release:
|
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
|
runs-on: ubuntu-latest
|
|
container: debian:11
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install build dependencies
|
|
run: apt-get update && apt-get install -y --no-install-recommends make g++ git tar ca-certificates
|
|
|
|
- name: Build release tarball
|
|
run: make release VERSION=${{ github.ref_name }}
|
|
|
|
- name: Upload workflow artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: fetchit-${{ github.ref_name }}-linux-x86_64-gnu
|
|
path: dist/*.tar.gz
|
|
|
|
- name: Publish GitHub release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: dist/*.tar.gz
|
|
generate_release_notes: true
|