-
-
Notifications
You must be signed in to change notification settings - Fork 15
150 lines (132 loc) Β· 5.82 KB
/
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
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
143
144
145
146
147
148
149
150
name: Launch Release
on:
push:
branches:
- publish
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# --- SETUP ---
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Get package info
id: package_info
run: |
echo "::set-output name=version::$(node -p "require('./package.json').version")"
echo "::set-output name=name::$(node -p "require('./package.json').name")"
# --- BUILD ---
- name: Install dependencies
run: npm install
- name: Build extension
run: npm run prod
# - name: Prepare source code zip
# run: zip -r releases/${{ steps.package_info.outputs.name }}_${{ github.run_number }}_firefox_source.zip src/
# --- TAG ---
- name: Create Tag
run: git tag v${{ steps.package_info.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push Tag
run: git push origin v${{ steps.package_info.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# --- CHANGELOG ---
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
configurationJson: |
{
"template": "#{{CHANGELOG}}\n\n**Full Changelog:** #{{RELEASE_DIFF}}",
"pr_template": "- #{{TITLE}} by @#{{AUTHOR}} in ##{{NUMBER}}",
"categories": [
{
"title": "## What's Changed"
}
]
}
# --- RELEASE ---
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.package_info.outputs.version }}
release_name: β© v${{ steps.package_info.outputs.version }}
body: ${{ steps.github_release.outputs.changelog }}
draft: false
prerelease: false
- name: Upload Release Asset Chrome
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./releases/${{ steps.package_info.outputs.name }}_${{ steps.package_info.outputs.version }}_chrome.zip
asset_name: ${{ steps.package_info.outputs.name }}_${{ steps.package_info.outputs.version }}_chrome.zip
asset_content_type: application/zip
- name: Upload Release Asset Firefox
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./releases/${{ steps.package_info.outputs.name }}_${{ steps.package_info.outputs.version }}_firefox.zip
asset_name: ${{ steps.package_info.outputs.name }}_${{ steps.package_info.outputs.version }}_firefox.zip
asset_content_type: application/zip
# - name: Download CRX and XPI files
# run: |
# wget -O releases/save-my-phind_${{ steps.package_version.outputs.version }}_chrome.crx "https://clients2.google.com/service/update2/crx?response=redirect&prodversion=90.0.4430.212&acceptformat=crx2,crx3&x=id%3Dagklnagmfeooogcppjccdnoallkhgkod%26uc"
#
# - name: Upload Release Asset Chrome CRX
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ./releases/save-my-phind_${{ steps.package_version.outputs.version }}_chrome.crx
# asset_name: save-my-phind_${{ steps.package_version.outputs.version }}_chrome.crx
# asset_content_type: application/x-chrome-extension
#
# - name: Upload Release Asset Firefox XPI
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ./releases/save-my-phind_${{ steps.package_version.outputs.version }}_firefox.xpi
# asset_name: save-my-phind_${{ steps.package_version.outputs.version }}_firefox.xpi
# asset_content_type: application/x-xpinstall
# --- DISCUSSION ---
- name: Create a new GitHub Discussion
uses: abirismyname/[email protected]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: "π€ Hey, it's an update: Save My Chatbot v${{ steps.package_info.outputs.version }}"
body: ${{ steps.github_release.outputs.changelog }}
repository-id: ${{ secrets.repository_id }}
category-id: ${{ secrets.category_id }}
# --- PUBLISH ---
- name: Browser Platform Publish
uses: PlasmoHQ/[email protected]
with:
keys: ${{ secrets.BPP_KEYS }}
chrome-file: releases/${{ steps.package_info.outputs.name }}_${{ steps.package_info.outputs.version }}_chrome.zip
firefox-file: releases/${{ steps.package_info.outputs.name }}_${{ steps.package_info.outputs.version }}_firefox.zip
edge-file: releases/${{ steps.package_info.outputs.name }}_${{ steps.package_info.outputs.version }}_chrome.zip
# --- CLEANUP ---
- name: Delete the 'publish' branch
if: github.ref == 'refs/heads/publish'
run: |
git push origin --delete publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}