-
-
Notifications
You must be signed in to change notification settings - Fork 24
75 lines (63 loc) · 2.42 KB
/
beta-release.yaml
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
# https://github.com/SilentVoid13/Templater/blob/master/.github/workflows/release.yml
name: Plugin-beta release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+-[0-9]+-beta"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout current branch
uses: actions/checkout@v3
with:
# This checks out the branch that triggered the workflow
submodules: recursive
ref: ${{ github.ref }}
- name: Fetch all branches
run: git fetch --all
- name: Extract version from tag
id: extract_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Strip -beta from version
run: |
VERSION=${{ env.VERSION }}
RELEASE_VERSION=${VERSION%-beta}
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
# Update manifest-beta.json in main branch
- name: Checkout main branch to update manifest-beta.json
run: |
git checkout main
git pull origin main
- name: Update manifest-beta.json in main branch
run: |
VERSION=${{ env.VERSION }}
jq --arg version "$VERSION" '.version = $version' manifest-beta.json > manifest-beta-temp.json
mv manifest-beta-temp.json manifest-beta.json
- name: Commit and push manifest-beta.json changes in main
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add manifest-beta.json
git commit -m "Update manifest-beta.json to version $VERSION in main branch"
git push origin main
# Switch back to the original branch that triggered the workflow
- name: Switch back to branch that triggered the workflow
run: |
git checkout ${{ github.ref_name }}
git pull origin ${{ github.ref_name }}
- name: npm build
run: |
npm install
npm run build --if-present
- name: Set Release Name
run: echo "RELEASE_NAME=${{ env.RELEASE_VERSION }}" >> $GITHUB_ENV
- name: Create Plugin beta release
uses: ncipollo/[email protected]
with:
name: Beta release ${{ env.RELEASE_NAME }}
prerelease: true
artifacts: "main.js,manifest.json,styles.css"
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.VERSION }}