renamed workflows to gitea (#1)
Reviewed-on: #1 Co-authored-by: dutchie031 <timrorije@gmail.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
name: Compile Artifact
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Compile Spearhead
|
||||
uses: https://git.dutchie031.com/dutchie031/DcsMissionScriptingTools@action/v0
|
||||
with:
|
||||
source-root: ./src
|
||||
output-file: ./output/spearhead.lua
|
||||
|
||||
- name: Upload spearhead.lua artifact
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: spearhead-lua
|
||||
path: ./output/spearhead.lua
|
||||
@@ -0,0 +1,84 @@
|
||||
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
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
# Simple workflow for deploying static content to GitHub Pages
|
||||
name: Deploy static content to Pages
|
||||
|
||||
on:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
||||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
# Single deploy job since we're just deploying
|
||||
deploy:
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get latest stable release
|
||||
id: latest_release
|
||||
run: |
|
||||
# Use GitHub API to get the latest stable release
|
||||
release_data=$(curl -s -w "%{http_code}" https://api.github.com/repos/${{ github.repository }}/releases/latest -o response.json)
|
||||
|
||||
# Check if we got a successful response (200) or if there are no releases (404)
|
||||
if [ "$release_data" = "200" ]; then
|
||||
# Extract the tag name and published date from the successful response
|
||||
latest_release=$(cat response.json | jq -r .tag_name)
|
||||
release_date=$(cat response.json | jq -r .published_at | cut -d'T' -f1)
|
||||
|
||||
# Format the date nicely
|
||||
formatted_date=$(date -d "$release_date" +"%B %d, %Y")
|
||||
|
||||
# Set the outputs
|
||||
echo "tag=$latest_release" >> $GITHUB_OUTPUT
|
||||
echo "date=$formatted_date" >> $GITHUB_OUTPUT
|
||||
|
||||
# Print for debugging
|
||||
echo "Latest stable release: $latest_release, published on: $formatted_date"
|
||||
else
|
||||
echo "No stable releases found"
|
||||
echo "tag=No stable release" >> $GITHUB_OUTPUT
|
||||
echo "date=Not available" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Get latest beta release
|
||||
id: latest_beta
|
||||
run: |
|
||||
# Use GitHub API to get all releases including prereleases
|
||||
releases_data=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases)
|
||||
|
||||
# Extract the first prerelease (most recent) using jq
|
||||
beta_data=$(echo "$releases_data" | jq -c '.[] | select(.prerelease==true)' | head -n 1)
|
||||
|
||||
# Check if a beta release exists
|
||||
if [ -z "$beta_data" ]; then
|
||||
echo "No beta releases found"
|
||||
echo "tag=None" >> $GITHUB_OUTPUT
|
||||
echo "date=Not available" >> $GITHUB_OUTPUT
|
||||
else
|
||||
# Extract the tag name and published date
|
||||
beta_release=$(echo "$beta_data" | jq -r .tag_name)
|
||||
beta_date=$(echo "$beta_data" | jq -r .published_at | cut -d'T' -f1)
|
||||
|
||||
# Format the date nicely
|
||||
formatted_date=$(date -d "$beta_date" +"%B %d, %Y")
|
||||
|
||||
# Set the outputs
|
||||
echo "tag=$beta_release" >> $GITHUB_OUTPUT
|
||||
echo "date=$formatted_date" >> $GITHUB_OUTPUT
|
||||
|
||||
# Print for debugging
|
||||
echo "Latest beta release: $beta_release, published on: $formatted_date"
|
||||
fi
|
||||
|
||||
# Example of using the release info in subsequent steps
|
||||
- name: Update version in documentation
|
||||
run: |
|
||||
echo "Updating documentation with stable version: ${{ steps.latest_release.outputs.tag }}"
|
||||
echo "Stable release date: ${{ steps.latest_release.outputs.date }}"
|
||||
echo "Updating documentation with beta version: ${{ steps.latest_beta.outputs.tag }}"
|
||||
echo "Beta release date: ${{ steps.latest_beta.outputs.date }}"
|
||||
|
||||
# Replace stable version placeholders
|
||||
find _docs -type f -name "*.html" -exec sed -i "s/#{VERSION}#/${{ steps.latest_release.outputs.tag }}/g" {} \;
|
||||
find _docs -type f -name "*.html" -exec sed -i "s/#{VERSION_DATE}#/${{ steps.latest_release.outputs.date }}/g" {} \;
|
||||
|
||||
# Replace beta version placeholders
|
||||
find _docs -type f -name "*.html" -exec sed -i "s/#{BETA_VERSION}#/${{ steps.latest_beta.outputs.tag }}/g" {} \;
|
||||
find _docs -type f -name "*.html" -exec sed -i "s/#{BETA_VERSION_DATE}#/${{ steps.latest_beta.outputs.date }}/g" {} \;
|
||||
|
||||
- name: Install Python and Pygments
|
||||
run: |
|
||||
python3 -m pip install --upgrade pip
|
||||
pip install pygments
|
||||
|
||||
- name: Highlight API code and update HTML
|
||||
run: |
|
||||
pygmentize -f html -l lua -O noclasses,style=monokai classes/api/SpearheadApiDoc.lua > _docs/pages/temp_api_code.html
|
||||
# Insert the highlighted code into the placeholder in spearheadapi.html
|
||||
sed -i '/@@API_CODE@@/r _docs/pages/temp_api_code.html' _docs/pages/spearheadapi.html
|
||||
sed -i '/@@API_CODE@@/d' _docs/pages/spearheadapi.html
|
||||
rm _docs/pages/temp_api_code.html
|
||||
|
||||
- name: Highlight API code and update HTML
|
||||
run: |
|
||||
pygmentize -f html -l lua -O noclasses,style=monokai ./config.lua > _docs/pages/temp_config_code.html
|
||||
# Insert the highlighted code into the placeholder in spearheadapi.html
|
||||
sed -i '/@@CONFIG_CODE@@/r _docs/pages/temp_config_code.html' _docs/pages/reference.html
|
||||
sed -i '/@@CONFIG_CODE@@/d' _docs/pages/reference.html
|
||||
rm _docs/pages/temp_config_code.html
|
||||
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v5
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: './_docs'
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
Reference in New Issue
Block a user