-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (66 loc) · 2.35 KB
/
release.yml
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
name: Create release
on:
push:
branches:
- master
workflow_dispatch:
env:
PACKAGE_JSON: "./package.json"
PACKAGE_PATH: "."
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
with:
fetch-tags: true
- run: |
git fetch --unshallow --tags
echo $?
git tag --list
- name: Get package properties
id: package_data
uses: zoexx/github-action-json-file-properties@1.0.4
with:
file_path: "${{ env.PACKAGE_JSON }}"
- name: Get last tag
run: |
echo "old_tag=$(git describe --tags --abbrev=0)" | tee -a $GITHUB_ENV
- name: Parse git tag version
id: tag_version
uses: madhead/semver-utils@v3.1.0
with:
lenient: false
version: ${{ env.old_tag }}
compare-to: ${{ steps.package_data.outputs.version }}
- name: Pick Incremented old tag
id: tag_pre_release
if: ${{ steps.tag_version.outputs.comparison-result != '<' }}
run: |
echo "version=${{ steps.tag_version.outputs.inc-patch }}" >> $GITHUB_ENV
- name: Pick package version
id: tag_post_release
if: ${{ steps.tag_version.outputs.comparison-result == '<' }}
run: |
echo "version=${{ steps.package_data.outputs.version }}" >> $GITHUB_ENV
- name: Replace version in package.json
run: jq ' .version = "${{ env.version }}"' ${{ env.PACKAGE_JSON }} > tmp && mv tmp ${{ env.PACKAGE_JSON }}
- name: Create Package Zip
working-directory: "${{ env.PACKAGE_PATH }}"
run: zip -r "${{ steps.package_data.outputs.name }}-${{ env.version }}.zip" . -x ".git/*" ".github/*"
- name: Create Tag
id: create_tag
uses: rickstaa/action-create-tag@88dbf7ff6fe2405f8e8f6c6fdfd78829bc631f83
with:
tag: ${{ env.version }}
- name: Make Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
with:
files: |
${{ steps.package_data.outputs.name }}-${{ env.version }}.unitypackage
${{ steps.package_data.outputs.name }}-${{ env.version }}.zip
${{ env.PACKAGE_JSON }}
tag_name: ${{ env.version }}