Files
spearhead/.gitea/workflows/release.yml
T
dutchie031 4cc0d19cbe renamed workflows to gitea (#1)
Reviewed-on: #1
Co-authored-by: dutchie031 <timrorije@gmail.com>
2026-07-24 21:48:01 +00:00

85 lines
2.6 KiB
YAML

name: Publish Release
on:
push:
branches:
- main
paths:
- version.txt
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Read Version from version.txt
id: read_version
run: |
VERSION=$(cat version.txt)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
echo "Version: $VERSION"
- name: Compile Spearhead
uses: https://git.dutchie031.com/dutchie031/DcsMissionScriptingTools@action/v0
with:
source-root: ./src
output-file: ./output/spearhead.lua
- name: Check for existing tag
id: check_tag
run: |
if git tag | grep -q "^${{ steps.read_version.outputs.tag }}$"; then
echo "Tag already exists. Exiting."
exit 1
fi
- name: Apply Tag to Current Commit
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git tag ${{ steps.read_version.outputs.tag }}
git push origin ${{ steps.read_version.outputs.tag }}
- name: Copy Release to Versioned File
run: |
cp ./output/spearhead.lua ./output/spearhead.${{ steps.read_version.outputs.tag }}.lua
echo "Versioned file created: spearhead.${{ steps.read_version.outputs.tag }}.lua"
- name: Create GitHub Release
uses: actions/create-release@v1
id: create_release
with:
tag_name: ${{ steps.read_version.outputs.tag }}
release_name: Release ${{ steps.read_version.outputs.tag }}
draft: true
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Spearhead.lua Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./output/spearhead.lua
asset_name: spearhead.lua
asset_content_type: application/octet-stream
- name: Upload Versioned Spearhead.lua Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./output/spearhead.${{ steps.read_version.outputs.tag }}.lua
asset_name: spearhead.${{ steps.read_version.outputs.tag }}.lua
asset_content_type: application/octet-stream