-
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (95 loc) · 3.32 KB
/
build_and_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
name: Build and Release
on:
push:
tags:
- '**'
branches:
- main
jobs:
build-and-release:
permissions:
contents: write
discussions: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- uses: pnpm/action-setup@v4
- name: Install dependencies and build
run: |
pnpm install
pnpm run build
# - name: Auto Generate Documentation
# run: |
# pnpm run doc
# - name: Commit Documentation
# run: |
# git config --global user.email "github-actions[bot]@users.noreply.github.com"
# git config --global user.name "GitHub Actions"
# if [[ -n $(git status -s) ]]; then
# git add README.md
# git commit -m "Update Readme.md"
# else
# echo "No changes to commit"
# fi
# - name: Push Documentation
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: main
# - name: Get last modified file
# id: getfile
# run: |
# last_modified_file=$(ls -Art dist | tail -n 1)
# echo "Last modified file: $last_modified_file"
# echo "filename=$last_modified_file" >> $GITHUB_OUTPUT
# version=$(echo $last_modified_file | sed -n 's/.*-\([0-9.]*\).c3addon/\1/p')
# echo "Last modified file version: $version"
# echo "version=$version" >> $GITHUB_OUTPUT
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/**/*
# - name: Check if variables are set
# id: check
# run: |
# publish=true
# if [[ -z "${{ secrets.C3_AUTH_USER }}" ]]; then
# echo "C3 AUTH_USER is not set. skip publishing."
# publish=false
# fi
# if [[ -z "${{ secrets.C3_AUTH_PASSWORD }}" ]]; then
# echo "C3 AUTH_PASSWORD is not set. skip publishing."
# publish=false
# fi
# echo "publish=$publish" >> $GITHUB_OUTPUT
# - name: Install publish dependencies
# if: steps.check.outputs.publish == 'true'
# run: |
# npm install -g c3addon
# - name: Get Addon Url
# if: steps.check.outputs.publish == 'true'
# id: url
# run: |
# url=$(grep -oP 'addonUrl:\s?"\K[^"]*' src/pluginConfig.js | cut -d '"' -f 1)
# echo "Addon Url: $url"
# if [[ -z "$url" ]]; then
# echo "Addon Url is not set. skip publishing."
# exit 1
# fi
# echo "url=$url" >> $GITHUB_OUTPUT
# - name: Publish to Construct 3
# if: steps.check.outputs.publish == 'true'
# run: |
# c3addon publish \
# --addonUrl '${{steps.url.outputs.url}}' \
# --authUser ${{ secrets.C3_AUTH_USER }} \
# --authPassword ${{ secrets.C3_AUTH_PASSWORD }} \
# --uploadFile dist/${{ steps.getfile.outputs.filename }} \
# --version ${{ steps.getfile.outputs.version }} \
# --releaseNotes 'Released via GitHub Actions'