Repository navigation
83 lines (73 loc) · 2.45 KB
/
Copy pathrelease.yml
File metadata and controls
83 lines (73 loc) · 2.45 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
name: Build release on Master Push
on:
push:
branches:
- master
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install tools
run: |
sudo apt-get update
sudo apt-get install -y libxml2-utils p7zip-full
- name: Extract version from modDesc.xml
id: get_version
run: |
VERSION=$(xmllint --xpath "string(//modDesc/version)" modDesc.xml)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Detected version: $VERSION"
- name: Get latest release
id: get_latest
uses: actions/github-script@v7
with:
script: |
const latest = await github.rest.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo
}).catch(() => null);
return latest ? latest.data.tag_name : "";
result-encoding: string
- name: Check version bump
run: |
LATEST="${{ steps.get_latest.outputs.result }}"
if [ "$LATEST" = "v${{ env.VERSION }}" ]; then
echo "Version $LATEST already released. Please bump version in modDesc and update the changelog!"
exit 1
fi
- name: Create archive with exclusions
run: |
7z a -tzip "${{ github.event.repository.name }}.zip" \
-xr!*.cmd -xr!*.zip -xr!*.yml -xr!\$data \
-xr!*.blend \
-xr!.svn \
-xr!.editorconfig \
-xr!.git -xr!.github -xr!.gitattributes -xr!.gitignore \
-xr!.mayaSwatches -xr!*.mel -xr!*.mb -xr!*.ma \
-xr!substance \
-xr!*.obj -xr!*.fbx -xr!*.txt -xr!*.md \
-xr!*.png -xr!*.psd -xr!*.tga -xr!*.gim -xr!*.pdn \
-xr!.idea -xr!.vscode \
.
- name: Create Git tag if not exists
run: |
TAG="v${{ env.VERSION }}"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists."
else
echo "Creating tag $TAG..."
git tag "$TAG" -f
git push --tags
fi
- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: v${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
name: "Release v${{ env.VERSION }}"
artifacts: |
*.zip