generated from techno-dwarf-works/unity-package-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (91 loc) · 2.79 KB
/
upm-publish.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Publish UPM Package
# Controls when the workflow will run
on:
pull_request:
branches:
- main
types: [closed]
workflow_dispatch:
inputs:
run_manually:
description: 'Run Manually'
required: true
default: true
type: boolean
jobs:
convert_string:
name: Prepare String
runs-on: ubuntu-latest
outputs:
converted_string: ${{ steps.convertString.outputs.convertedString }}
steps:
- name: Set the original string
id: setOriginalString
run: echo "::set-output name=originalString::${{ github.event.repository.name }}"
- name: Convert string
id: convertString
run: |
ORIGINAL_STRING="${{ steps.setOriginalString.outputs.originalString }}"
IFS='-' read -ra PARTS <<< "$ORIGINAL_STRING"
RESULT=""
for PART in "${PARTS[@]}"; do
RESULT="${RESULT}$(echo "${PART^}")"
done
echo "::set-output name=convertedString::${RESULT}"
prepare:
needs: convert_string
name: Prepare
if: ${{ inputs.run_manually }} || github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Copy the README
run: |
cp "README.md" "Assets/${{ needs.convert_string.outputs.converted_string }}/README.md"
- name: Copy the LICENSE
run: |
cp "LICENSE" "Assets/${{ needs.convert_string.outputs.converted_string }}/LICENSE"
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v11.1
id: verify-changed-files
with:
files: |
**/README.md
**/LICENSE
- name: Commit files
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email ${{secrets.ADMIN_MAIL}}
git config --local user.name ${{secrets.ADMIN_NAME}}
git add .
git commit -m "Update README.md and LICENSE" -a
- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
deploy:
needs:
- convert_string
- prepare
name: Deploy
if: ${{ success() }}
runs-on: ubuntu-latest
steps:
# Any prerequisite steps
- name: Checkout latest
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main
lfs: true
# Deploy to local repo
- name: Deploy
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: upm
FOLDER: Assets/${{ needs.convert_string.outputs.converted_string }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SKIP_EMPTY_COMMITS: true
MESSAGE: "{msg}"