From bb9144e3a058f2221eb4f9d191f6eb9c0628dc59 Mon Sep 17 00:00:00 2001 From: dutchie031 Date: Fri, 14 Aug 2026 18:57:33 +0000 Subject: [PATCH] updating develop branch now automatically creates beta release (#16) Reviewed-on: https://git.dutchie031.com/Spearhead/spearhead/pulls/16 Co-authored-by: dutchie031 --- .gitea/workflows/release-beta.yml | 89 +++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 .gitea/workflows/release-beta.yml diff --git a/.gitea/workflows/release-beta.yml b/.gitea/workflows/release-beta.yml new file mode 100644 index 0000000..0173bb7 --- /dev/null +++ b/.gitea/workflows/release-beta.yml @@ -0,0 +1,89 @@ +name: Publish Release + +on: + push: + branches: + - develop + paths: + - src/** + workflow_dispatch: + +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=beta + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "tag=v$VERSION" >> "$GITHUB_OUTPUT" + echo "Version: $VERSION" + + - name: Extract Release Notes + id: release_notes + run: | + VERSION=beta + RELEASE_NOTES=$(awk -v ver="Unreleased" ' + /^## \[/ { + if (found) exit + if (index($0, "[" ver "]") > 0) found = 1 + next + } + found { print } + ' RELEASENOTES.md) + + # Write multi-line output properly + echo "body<> "$GITHUB_OUTPUT" + echo "$RELEASE_NOTES" >> "$GITHUB_OUTPUT" + echo "EOF" >> "$GITHUB_OUTPUT" + + - name: Compile Spearhead + uses: https://git.dutchie031.com/dutchie031/DcsMissionScriptingTools/github-action@action/v0 + with: + source-root: ./src + output-file: ./output/spearhead.lua + + - name: Remove existing tag if it exists + id: check_tag + run: | + TAG="${{ steps.read_version.outputs.tag }}" + if git tag | grep -q "^$TAG$"; then + echo "Tag exists. Removing it..." + git push origin :refs/tags/"$TAG" || true + git tag -d "$TAG" || true + fi + echo "Ready to create fresh tag: $TAG" + + - 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 Release and Upload Assets + uses: akkuman/gitea-release-action@v1 + with: + tag_name: ${{ steps.read_version.outputs.tag }} + name: Release ${{ steps.read_version.outputs.tag }} + body: ${{ steps.release_notes.outputs.body }} + prerelease: true + files: |- + ./output/spearhead.lua + ./output/spearhead.${{ steps.read_version.outputs.tag }}.lua + #token: ${{ secrets.GITHUB_TOKEN }} + env: + NODE_OPTIONS: '--experimental-fetch' +