generated from Emiliopg91/decky-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (119 loc) · 4.21 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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Build and Publish Release
permissions:
contents: write
on:
push:
branches:
- main
jobs:
CompileAndRelease:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get version from package.json
id: get_version
run: |
VERSION=$(jq -r '.version' package.json | sed 's/-.*//')
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Package version: $VERSION"
- name: Bump to release version
run: |
npm version --no-commit-hooks --no-git-tag-version ${{ env.VERSION }}
- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add package.json
git commit -m "Bump to release version"
git push origin HEAD:main
- name: Fix permissions
run: |
chmod 777 -R .
- name: Setup Docker
uses: docker/setup-buildx-action@v1
- name: Build Docker image
run: docker build -t my_backend_image ./backend
working-directory: ${{ github.workspace }}
- name: Run Docker container
run: docker run -v ${{ github.workspace }}/backend:/backend my_backend_image
working-directory: ${{ github.workspace }}
- name: build plugin
run: |
npm i -g [email protected] [email protected]
pnpm install --no-frozen-lockfile
pnpm run build
- name: Archive plugin
run: |
mkdir output
cp -r dist output/dist
cp LICENSE output/LICENSE
cp main.py output/main.py
cp -r py_modules output/py_modules
cp output/plugin.json
cp package.json output/package.json
cp plugin.json output/plugin.json
cp README.md output/README.md
cp defaults/* output
cd output
tar -czvf AllyDeckyCompanion.tar.gz --transform 's,^,AllyDeckyCompanion/,' *
continue-on-error: true
- name: show files
run: |
tar -tzvf output/AllyDeckyCompanion.tar.gz
- name: Publish Artifacts
uses: actions/upload-artifact@v3
with:
name: AllyDeckyCompanion
path: output/AllyDeckyCompanion.tar.gz
- name: Create and push tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git tag -a "${{ env.VERSION }}" -m "Release version ${{ env.VERSION }}"
git push origin "${{ env.VERSION }}"
- name: Checkout develop branch
run: |
git restore .
git fetch origin
git checkout develop
git pull origin develop
- name: Merge main into develop
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git merge -X theirs main --allow-unrelated-histories
git push origin HEAD:develop --force
- name: Bump version to next DEV version
run: |
npm version --no-commit-hooks --no-git-tag-version prepatch --preid dev
jq '.version |= sub("-dev\\.0$"; "-dev")' package.json > package.tmp.json
mv package.tmp.json package.json
- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add package.json
git commit -m "Bump version to prepatch"
git push origin HEAD:develop
- run: mkdir /tmp/artifacts
- name: download artifact
uses: actions/download-artifact@v3
with:
path: /tmp/artifacts
- run: ls -R /tmp/artifacts
- name: publish to github release
uses: softprops/action-gh-release@v1
with:
files: /tmp/artifacts/AllyDeckyCompanion/AllyDeckyCompanion.tar.gz
tag_name: ${{ env.VERSION }}
name: ${{ env.VERSION }}
body: |
AllyDeckyCompanion
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}