67 lines
2.2 KiB
YAML
67 lines
2.2 KiB
YAML
name: Create Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Version for this release (e.g. 1.0.0)'
|
|
required: true
|
|
default: ''
|
|
prerelease:
|
|
description: 'Is this a pre-release?'
|
|
required: true
|
|
default: 'false'
|
|
type: boolean
|
|
description:
|
|
description: 'Release description'
|
|
required: false
|
|
default: 'New release'
|
|
|
|
jobs:
|
|
create-release:
|
|
runs-on: macos
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
lfs: true
|
|
fetch-depth: 0
|
|
|
|
- name: Create Tag
|
|
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
|
|
run: |
|
|
TAG="v${{ github.run_number }}"
|
|
echo "Creating git tag: $TAG"
|
|
|
|
# Configure git with token authentication
|
|
git config --global user.email "actions@gitea.com"
|
|
git config --global user.name "Gitea Actions"
|
|
git remote set-url origin "https://${{ secrets.GITEATOKEN }}@gitea.com/luckyrobots/luckyworld.git"
|
|
|
|
if ! git rev-parse "$TAG" >/dev/null 2>&1; then
|
|
git tag -a "$TAG" -m "Release $TAG"
|
|
git push origin "$TAG"
|
|
fi
|
|
echo "RELEASE_TAG=$TAG" >> $GITHUB_ENV
|
|
|
|
- name: Create Gitea Release
|
|
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
|
|
uses: actions/gitea-release-action@main
|
|
with:
|
|
token: ${{ secrets.GITEATOKEN }}
|
|
tag_name: ${{ env.RELEASE_TAG }}
|
|
title: "Release ${{ env.RELEASE_TAG }}"
|
|
files: Builds/**
|
|
|
|
- name: Upload Release Assets
|
|
run: |
|
|
for file in builds/*; do
|
|
if [ -f "$file" ]; then
|
|
echo "Uploading $file"
|
|
curl -X POST \
|
|
-H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
--data-binary @"$file" \
|
|
"https://luckyrobots.com/api/v1/repos/owner/repo/releases/${{ steps.create_release.outputs.release_id }}/assets?name=$(basename "$file")"
|
|
fi
|
|
done |