Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1febc63f2 | ||
|
|
c7a65d6fbd | ||
|
|
12d3ad3341 | ||
|
|
0443871583 | ||
|
|
1db8f3ccbb | ||
|
|
83df0813c6 |
@@ -1,200 +0,0 @@
|
||||
name: Publish GitHub Action
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- github-action/package.json
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
verify_action:
|
||||
name: Verify action
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: npm
|
||||
cache-dependency-path: github-action/package-lock.json
|
||||
|
||||
- name: Install action dependencies
|
||||
working-directory: github-action
|
||||
run: npm ci
|
||||
|
||||
- name: Create verification fixture
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p test-action-input
|
||||
cat <<'EOF' > test-action-input/main.lua
|
||||
local message = {}
|
||||
|
||||
message.hello = function()
|
||||
return "hello"
|
||||
end
|
||||
|
||||
return message
|
||||
EOF
|
||||
|
||||
- name: Run action locally
|
||||
uses: ./github-action
|
||||
with:
|
||||
source-root: test-action-input
|
||||
output-file: test-action-output/compiled.lua
|
||||
|
||||
- name: Assert compiled output exists
|
||||
shell: bash
|
||||
run: test -f test-action-output/compiled.lua
|
||||
|
||||
derive_release:
|
||||
name: Derive release metadata
|
||||
runs-on: ubuntu-latest
|
||||
needs: verify_action
|
||||
outputs:
|
||||
version: ${{ steps.derive.outputs.version }}
|
||||
release_tag: ${{ steps.derive.outputs.release_tag }}
|
||||
rolling_minor_tag: ${{ steps.derive.outputs.rolling_minor_tag }}
|
||||
rolling_major_tag: ${{ steps.derive.outputs.rolling_major_tag }}
|
||||
bump_kind: ${{ steps.derive.outputs.bump_kind }}
|
||||
should_publish: ${{ steps.derive.outputs.should_publish }}
|
||||
latest_release_tag: ${{ steps.derive.outputs.latest_release_tag }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Derive version and tags
|
||||
id: derive
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
version=$(node -p "require('./github-action/package.json').version")
|
||||
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "github-action/package.json version must be semver X.Y.Z, got: $version" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IFS='.' read -r major minor patch <<< "$version"
|
||||
release_tag="action/v${version}"
|
||||
rolling_minor_tag="action/v${major}.${minor}"
|
||||
rolling_major_tag="action/v${major}"
|
||||
|
||||
latest_release_tag=$(git tag --list 'action/v*.*.*' --sort=-version:refname | head -n 1)
|
||||
|
||||
bump_kind="initial"
|
||||
should_publish="true"
|
||||
|
||||
if [[ -n "$latest_release_tag" ]]; then
|
||||
latest_version=${latest_release_tag#action/v}
|
||||
|
||||
if [[ "$version" == "$latest_version" ]]; then
|
||||
should_publish="false"
|
||||
bump_kind="duplicate"
|
||||
else
|
||||
IFS='.' read -r latest_major latest_minor latest_patch <<< "$latest_version"
|
||||
|
||||
if (( major < latest_major )) || \
|
||||
(( major == latest_major && minor < latest_minor )) || \
|
||||
(( major == latest_major && minor == latest_minor && patch < latest_patch )); then
|
||||
echo "github-action/package.json version $version must be greater than latest published $latest_version" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if (( major > latest_major )); then
|
||||
bump_kind="major"
|
||||
elif (( minor > latest_minor )); then
|
||||
bump_kind="minor"
|
||||
elif (( patch > latest_patch )); then
|
||||
bump_kind="patch"
|
||||
else
|
||||
echo "Unable to derive release kind from $latest_version -> $version" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||
echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT"
|
||||
echo "rolling_minor_tag=$rolling_minor_tag" >> "$GITHUB_OUTPUT"
|
||||
echo "rolling_major_tag=$rolling_major_tag" >> "$GITHUB_OUTPUT"
|
||||
echo "bump_kind=$bump_kind" >> "$GITHUB_OUTPUT"
|
||||
echo "should_publish=$should_publish" >> "$GITHUB_OUTPUT"
|
||||
echo "latest_release_tag=$latest_release_tag" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Summarize release plan
|
||||
shell: bash
|
||||
run: |
|
||||
{
|
||||
echo "## Action release plan"
|
||||
echo ""
|
||||
echo "- Version: ${{ steps.derive.outputs.version }}"
|
||||
echo "- Release tag: ${{ steps.derive.outputs.release_tag }}"
|
||||
echo "- Rolling minor tag: ${{ steps.derive.outputs.rolling_minor_tag }}"
|
||||
echo "- Rolling major tag: ${{ steps.derive.outputs.rolling_major_tag }}"
|
||||
echo "- Bump kind: ${{ steps.derive.outputs.bump_kind }}"
|
||||
echo "- Latest published tag: ${{ steps.derive.outputs.latest_release_tag || 'none' }}"
|
||||
echo "- Will publish: ${{ steps.derive.outputs.should_publish }}"
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
publish_tags:
|
||||
name: Publish tags
|
||||
runs-on: ubuntu-latest
|
||||
needs: derive_release
|
||||
if: ${{ needs.derive_release.outputs.should_publish == 'true' }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Create immutable release tag
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
release_tag='${{ needs.derive_release.outputs.release_tag }}'
|
||||
|
||||
if git rev-parse "$release_tag" >/dev/null 2>&1; then
|
||||
echo "Release tag $release_tag already exists" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git tag "$release_tag" "$GITHUB_SHA"
|
||||
|
||||
- name: Update rolling tags
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git tag -f '${{ needs.derive_release.outputs.rolling_minor_tag }}' "$GITHUB_SHA"
|
||||
git tag -f '${{ needs.derive_release.outputs.rolling_major_tag }}' "$GITHUB_SHA"
|
||||
|
||||
- name: Push release tags
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git push origin '${{ needs.derive_release.outputs.release_tag }}'
|
||||
git push origin '${{ needs.derive_release.outputs.rolling_minor_tag }}' --force
|
||||
git push origin '${{ needs.derive_release.outputs.rolling_major_tag }}' --force
|
||||
|
||||
- name: Summarize published tags
|
||||
shell: bash
|
||||
run: |
|
||||
{
|
||||
echo "## Published action tags"
|
||||
echo ""
|
||||
echo "- Immutable: ${{ needs.derive_release.outputs.release_tag }}"
|
||||
echo "- Rolling minor: ${{ needs.derive_release.outputs.rolling_minor_tag }}"
|
||||
echo "- Rolling major: ${{ needs.derive_release.outputs.rolling_major_tag }}"
|
||||
echo "- Bump kind: ${{ needs.derive_release.outputs.bump_kind }}"
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
@@ -11,7 +11,50 @@ permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
## Verify that when the action has been run it actually has the lua addons installed
|
||||
test_action:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: npm
|
||||
cache-dependency-path: github-actions/install-lua-addon/package-lock.json
|
||||
|
||||
- name: Run Action Locally
|
||||
uses: ./github-actions/install-lua-addon
|
||||
with:
|
||||
destination-path: './some/test/lua-addons'
|
||||
|
||||
- name: Verify lua addons were installed
|
||||
run: |
|
||||
echo "Listing contents of the Lua addons directory"
|
||||
ls -la ./some/test/lua-addons
|
||||
|
||||
echo "Checking if dcs-types addon was installed"
|
||||
if [ -d "./some/test/lua-addons/dcs-types" ]; then
|
||||
echo "✓ dcs-types directory found"
|
||||
else
|
||||
echo "✗ dcs-types directory not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking if config.json exists in dcs-types"
|
||||
if [ -f "./some/test/lua-addons/dcs-types/config.json" ]; then
|
||||
echo "✓ config.json found"
|
||||
else
|
||||
echo "✗ config.json not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "All checks passed!"
|
||||
|
||||
publish_action:
|
||||
needs: test_action
|
||||
uses: ./.github/workflows/_publish-action-release.yml
|
||||
with:
|
||||
action-directory: github-actions/install-lua-addon
|
||||
|
||||
@@ -34,20 +34,23 @@ jobs:
|
||||
- name: Exit if tag exists
|
||||
if: steps.tag_check.outputs.tag_exists == 'true'
|
||||
run: |
|
||||
echo "Tag already exists, exiting."
|
||||
exit 1
|
||||
echo "::warning::Tag already exists, exiting."
|
||||
exit 0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
if: steps.tag_check.outputs.tag_exists == 'false'
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.tag_check.outputs.tag_exists == 'false'
|
||||
run: |
|
||||
cd dutchies-dcs-scripting-tools
|
||||
npm install
|
||||
|
||||
- name: Build extension
|
||||
if: steps.tag_check.outputs.tag_exists == 'false'
|
||||
run: |
|
||||
cd dutchies-dcs-scripting-tools
|
||||
npm run compile
|
||||
|
||||
@@ -35,7 +35,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dutchie031/DcsMissionScriptingTools/github-action@action/v1
|
||||
- uses: https://git.dutchie031.com/dutchie031/DcsMissionScriptingTools/github-actions/bundle-script@bundle-script/v1
|
||||
with:
|
||||
source-root: 'src'
|
||||
output-file: 'output/compiled.lua'
|
||||
@@ -59,7 +59,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dutchie031/DcsMissionScriptingTools/github-actions/install-lua-addon@action/v1
|
||||
- uses: https://git.dutchie031.com/dutchie031/DcsMissionScriptingTools/github-actions/install-lua-addon@install-lua-addon/v1
|
||||
with:
|
||||
destination-path: 'lua-addons'
|
||||
```
|
||||
@@ -42,6 +42,81 @@
|
||||
---@field Easting number
|
||||
---@field Northing number
|
||||
|
||||
do --mission table
|
||||
|
||||
---@class MissionTable
|
||||
---@field drawings Drawings
|
||||
---@field coalitions Coalitions
|
||||
---@field theatre string?
|
||||
---@field version number
|
||||
---@field start_time number
|
||||
---@field goals table?
|
||||
---@field weather table?
|
||||
|
||||
do -- drawings
|
||||
|
||||
---@class Drawings
|
||||
---@field options DrawingOptions
|
||||
---@field layers Array<DrawingLayer>
|
||||
|
||||
---@class DrawingOptions
|
||||
---@field hiddenOnF10Map HiddenOnF10Map
|
||||
|
||||
---@class HiddenOnF10Map
|
||||
---@field Observer HiddenOnF10MapSettings
|
||||
---@field Instructor HiddenOnF10MapSettings
|
||||
---@field ForwardObserver HiddenOnF10MapSettings
|
||||
---@field Spectator HiddenOnF10MapSettings
|
||||
---@field ArtilleryCommander HiddenOnF10MapSettings
|
||||
---@field Pilot HiddenOnF10MapSettings
|
||||
|
||||
---@class HiddenOnF10MapSettings
|
||||
---@field Neutral boolean
|
||||
---@field Blue boolean
|
||||
---@field Red boolean
|
||||
|
||||
---@class DrawingLayer
|
||||
---@field name string
|
||||
---@field visible boolean
|
||||
---@field objects Array<DrawingObject>
|
||||
|
||||
end
|
||||
|
||||
do -- coalitions
|
||||
---@class Coalitions
|
||||
---@field red Coalition
|
||||
---@field blue Coalition
|
||||
---@field neutral Coalition
|
||||
|
||||
---@class Coalition
|
||||
---@field bullseye Vec2
|
||||
---@field name string
|
||||
---@field nav_points Array<NavPoint>
|
||||
---@field country Array<Country>
|
||||
|
||||
---@class NavPoint
|
||||
---@field type string
|
||||
---@field comment string
|
||||
---@field callSignStr string
|
||||
---@field id number
|
||||
---@field properties table
|
||||
|
||||
---@class Country
|
||||
---@field id string
|
||||
---@field name string
|
||||
---@field vehicle Groups
|
||||
---@field plane Groups
|
||||
---@field helicopter Groups
|
||||
---@field static Groups
|
||||
---@field ship Groups
|
||||
|
||||
---@class Groups
|
||||
---@field group Array<table>
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
do -- env
|
||||
---@class env
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "dutchies-dcs-scripting-tools",
|
||||
"displayName": "Dutchies Dcs Scripting Tools",
|
||||
"description": "Scripting tools to create DCS script and frameworks easier",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"author": {
|
||||
"name": "dutchie031",
|
||||
"email": "54616262+dutchie031@users.noreply.github.com"
|
||||
|
||||
@@ -9,12 +9,6 @@ inputs:
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Copy lua-addons
|
||||
run: |
|
||||
cp -r ../dutchies-dcs-scripting-tools/lua-addons ./lua-addons
|
||||
shell: bash
|
||||
working-directory: ${{ github.action_path }}
|
||||
|
||||
- name: Build action
|
||||
run: |
|
||||
npm ci
|
||||
|
||||
@@ -1,9 +1,36 @@
|
||||
const esbuild = require("esbuild");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const production = process.argv.includes('--production');
|
||||
const watch = process.argv.includes('--watch');
|
||||
|
||||
async function copyDirectory(src, dest) {
|
||||
await fs.promises.mkdir(dest, { recursive: true });
|
||||
const entries = await fs.promises.readdir(src, { withFileTypes: true });
|
||||
|
||||
for (const entry of entries) {
|
||||
const srcPath = path.join(src, entry.name);
|
||||
const destPath = path.join(dest, entry.name);
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
await copyDirectory(srcPath, destPath);
|
||||
} else {
|
||||
await fs.promises.copyFile(srcPath, destPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
// Copy lua-addons to dist directory
|
||||
const luaAddonsSource = path.join(__dirname, '../../dutchies-dcs-scripting-tools/lua-addons');
|
||||
const luaAddonsDest = path.join(__dirname, 'dist/lua-addons');
|
||||
|
||||
if (fs.existsSync(luaAddonsSource)) {
|
||||
await copyDirectory(luaAddonsSource, luaAddonsDest);
|
||||
console.log('Lua addons copied to dist/');
|
||||
}
|
||||
|
||||
const ctx = await esbuild.context({
|
||||
entryPoints: [
|
||||
'src/index.ts'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gh-lua-addon-installer",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.2",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"build": "node esbuild.js",
|
||||
|
||||
@@ -27,9 +27,9 @@ async function run() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Reference lua-addons relative to the dist directory
|
||||
// __dirname is dist/, so lua-addons is one level up
|
||||
const bundledAddonsDir = path.resolve(__dirname, '../lua-addons');
|
||||
// Reference lua-addons bundled in dist directory
|
||||
// __dirname is dist/, lua-addons is bundled alongside
|
||||
const bundledAddonsDir = path.resolve(__dirname, './lua-addons');
|
||||
|
||||
// Verify bundled addons directory exists
|
||||
if (!existsSync(bundledAddonsDir)) {
|
||||
|
||||
Reference in New Issue
Block a user