-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (108 loc) · 3.82 KB
/
Copy pathci.yml
File metadata and controls
121 lines (108 loc) · 3.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: CI
on:
push:
branches:
- main
tags:
- "v*.*.*"
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }}
jobs:
project-checks:
name: Validate Unity Importer Plugin for Unity
runs-on: ubuntu-24.04
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Validate metadata and shortcuts
shell: bash
run: |
set -euo pipefail
python3 - <<'PY'
import json
import xml.etree.ElementTree as ET
from pathlib import Path
manifest = json.loads(Path("package.json").read_text(encoding="utf-8"))
expected = {
"name": "unity-animation-event",
"displayName": "Unity Importer Plugin for Unity",
"publisher": "martincalander",
"license": "MIT",
}
for key, value in expected.items():
if manifest.get(key) != value:
raise SystemExit(f"package.json {key!r} must be {value!r}")
keys_root = ET.parse("my_keys.aseprite-keys").getroot()
commands = {
element.attrib["command"]
for element in keys_root.findall(".//key")
if "command" in element.attrib
}
if len(commands) != 7:
raise SystemExit("expected exactly seven shortcut command bindings")
lua_source = Path("celcolor.lua").read_text(encoding="utf-8")
missing = sorted(command for command in commands if f'"{command}"' not in lua_source)
if missing:
raise SystemExit(f"shortcut commands missing from Lua source: {missing}")
PY
validate:
name: Validate and package
uses: soupmasters/workflow-aseprite-extension/.github/workflows/validate.yml@7f70a05b6d2931d8722f8a3d637f9e70b4b24447 # v1.1.0
main-artifact:
name: Upload installable extension
if: github.ref == 'refs/heads/main'
needs:
- project-checks
- validate
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
steps:
- name: Download validated package
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ needs.validate.outputs.artifact-name }}
path: dist
- name: Verify downloaded package
shell: bash
env:
CHECKSUM_NAME: ${{ needs.validate.outputs.checksum-name }}
run: |
set -euo pipefail
cd dist
sha256sum --check --strict "$CHECKSUM_NAME"
- name: Upload extension as a direct download
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
path: dist/${{ needs.validate.outputs.asset-name }}
if-no-files-found: error
retention-days: 14
archive: false
release:
name: Publish GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
needs:
- project-checks
- validate
permissions:
actions: read
contents: write
uses: soupmasters/workflow-aseprite-extension/.github/workflows/release.yml@7f70a05b6d2931d8722f8a3d637f9e70b4b24447 # v1.1.0
with:
artifact-name: ${{ needs.validate.outputs.artifact-name }}
asset-name: ${{ needs.validate.outputs.asset-name }}
checksum-name: ${{ needs.validate.outputs.checksum-name }}
package-name: ${{ needs.validate.outputs.package-name }}
display-name: ${{ needs.validate.outputs.display-name }}
version: ${{ needs.validate.outputs.version }}
sha256: ${{ needs.validate.outputs.sha256 }}