Files
NeoTachyon/.github/workflows/build.yml
T

121 lines
3.5 KiB
YAML

name: Build packages
on:
push:
tags:
- "*"
workflow_dispatch:
inputs:
release_tag:
description: Release tag to build and publish
required: true
type: string
release_notes:
description: Optional release notes/comment
required: false
type: string
permissions:
contents: write
jobs:
preparation:
name: Setup build version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
commitish: ${{ steps.version.outputs.commitish }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: version
shell: bash
run: |
INPUT_VERSION="${{ inputs.release_tag || '' }}"
if [ -n "$INPUT_VERSION" ]; then
VERSION="$INPUT_VERSION"
else
VERSION=$(git describe --tags --exact-match 2>/dev/null || true)
fi
VERSION="${VERSION#v}"
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Release version must use x.y.z format, got: ${VERSION:-<empty>}" >&2
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "commitish=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
build:
name: Build Tachyon release packages
runs-on: ubuntu-latest
needs: preparation
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build release artifacts
shell: bash
run: |
VERSION="${{ needs.preparation.outputs.version }}"
bash ./build.sh "$VERSION" "$PWD/filtered-bin/release"
ls -la "$PWD/filtered-bin/release"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: release-files-${{ needs.preparation.outputs.version }}
path: ./filtered-bin/release/*
retention-days: 1
if-no-files-found: error
release:
name: Create Release
runs-on: ubuntu-latest
needs:
- preparation
- build
steps:
- uses: actions/checkout@v4
- name: Create release dir
run: mkdir -p ./filtered-bin/release
- name: Download release artifacts
uses: actions/download-artifact@v4
with:
name: release-files-${{ needs.preparation.outputs.version }}
path: ./filtered-bin/release
- name: Release on tag push
if: ${{ github.event_name == 'push' }}
uses: softprops/action-gh-release@v2.4.0
with:
files: ./filtered-bin/release/*
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
target_commitish: ${{ needs.preparation.outputs.commitish }}
generate_release_notes: true
draft: false
prerelease: false
make_latest: true
overwrite_files: true
- name: Release on workflow dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: softprops/action-gh-release@v2.4.0
with:
files: ./filtered-bin/release/*
tag_name: ${{ needs.preparation.outputs.version }}
name: ${{ needs.preparation.outputs.version }}
target_commitish: ${{ needs.preparation.outputs.commitish }}
generate_release_notes: true
draft: false
prerelease: false
make_latest: true
overwrite_files: true
body: |
Commit: ${{ needs.preparation.outputs.commitish }}
${{ inputs.release_notes }}