-
-
Notifications
You must be signed in to change notification settings - Fork 12
103 lines (94 loc) · 3.1 KB
/
build-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
name: 📣 Build release of QOwnNotes Web Companion
on:
workflow_dispatch:
push:
branches:
- release
tags-ignore:
- '*'
#--------------------------------------------------------------------------------
# Define application name & version
#--------------------------------------------------------------------------------
jobs:
create_release:
name: '🗃️️ Prepare release'
permissions:
contents: write # for actions/create-release to create a release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
release_id: ${{ steps.create_release.outputs.id }}
steps:
- uses: actions/checkout@v4
- name: Set Env
run: |
export VERSION=$(jq -r '.version' package.json)
export TAG=v${VERSION}
export RELEASE_TEXT=$(grep -Pzo "## ${VERSION}\n(\n|.)+?\n##" CHANGELOG.md | sed '$ d')
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "TAG=${TAG}" >> $GITHUB_ENV
# add multiline release text
echo "RELEASE_TEXT<<EOF" >> $GITHUB_ENV
echo "${RELEASE_TEXT}" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Printenv
run: |
echo "VERSION=${VERSION}"
echo "TAG=${TAG}"
echo "RELEASE_TEXT=${RELEASE_TEXT}"
printenv
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG }}
release_name: Release v${{ env.VERSION }}
body: ${{ env.RELEASE_TEXT }}
draft: true
prerelease: false
#
# Package build
#
build-package:
needs: create_release
runs-on: ubuntu-latest
name: '📦 Build packages'
steps:
- name: '🧰 Checkout'
uses: actions/checkout@v4
- name: '⚙️ Install dependencies'
run: |
npm install
- name: '🚧 Build extension'
run: ./build.sh
- name: '📤 Release Chrome package'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./dist/package-chrome.zip
asset_name: package-chrome.zip
asset_content_type: application/zip
- name: '📤 Release Firefox package'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./dist/package-firefox.zip
asset_name: package-firefox.zip
asset_content_type: application/zip
publish_release:
name: 📣 Publish release
runs-on: ubuntu-latest
needs: [create_release, build-package]
steps:
- name: 📣 Publish draft release
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.create_release.outputs.release_id }}