Skip to content

Commit 8beac58

Browse files
committed
Fix deploy workflow.
1 parent b363495 commit 8beac58

1 file changed

Lines changed: 57 additions & 25 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 57 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,23 @@ on:
44
push:
55
branches: [master]
66

7+
permissions:
8+
contents: write
9+
actions: read
10+
711
jobs:
812
build:
913
name: Build Extension
1014
runs-on: ubuntu-latest
11-
outputs:
12-
version: ${{ steps.package-info.outputs.version }}
1315
steps:
1416
- uses: actions/checkout@v4
1517
with:
1618
fetch-depth: 0
1719
- uses: ./.github/actions/setup
1820
- run: yarn build:prod
1921

20-
- name: Get version info
21-
id: package-info
22-
run: |
23-
VERSION=$(git describe --tags --exact-match HEAD)
24-
echo "version=$VERSION" >> $GITHUB_OUTPUT
25-
2622
- name: Upload build artifacts
27-
uses: actions/upload-artifact@v5
23+
uses: actions/upload-artifact@v4
2824
with:
2925
name: extension-build
3026
path: dist/
@@ -40,15 +36,15 @@ jobs:
4036
- uses: ./.github/actions/setup
4137

4238
- name: Download build artifacts
43-
uses: actions/download-artifact@v5
39+
uses: actions/download-artifact@v4
4440
with:
4541
name: extension-build
4642
path: dist/
4743

4844
- run: yarn package:zip
4945

5046
- name: Upload package artifacts
51-
uses: actions/upload-artifact@v5
47+
uses: actions/upload-artifact@v4
5248
with:
5349
name: extension-package
5450
path: packages/
@@ -64,7 +60,7 @@ jobs:
6460
- uses: ./.github/actions/setup
6561

6662
- name: Download package artifacts
67-
uses: actions/download-artifact@v5
63+
uses: actions/download-artifact@v4
6864
with:
6965
name: extension-package
7066
path: packages/
@@ -77,19 +73,55 @@ jobs:
7773
CHROME_WEB_STORE_REFRESH_TOKEN: ${{ secrets.CHROME_WEB_STORE_REFRESH_TOKEN }}
7874
CHROME_WEB_STORE_APP_ID: ${{ secrets.CHROME_WEB_STORE_APP_ID }}
7975

80-
- name: Create GitHub Release
81-
uses: softprops/action-gh-release@v2
76+
release:
77+
name: Create GitHub Release
78+
runs-on: ubuntu-latest
79+
needs: [build, package, deploy]
80+
steps:
81+
- uses: actions/checkout@v4
82+
with:
83+
fetch-depth: 0
84+
85+
- name: Download package artifacts
86+
uses: actions/download-artifact@v4
8287
with:
83-
tag_name: ${{ needs.build.outputs.version }}
84-
name: Release ${{ needs.build.outputs.version }}
85-
body: |
86-
Extension package for version ${{ needs.build.outputs.version }}
87-
88-
This release has been automatically uploaded to the Chrome Web Store and submitted for review.
89-
files: |
90-
packages/*.zip
91-
draft: false
92-
prerelease: false
93-
make_latest: true
88+
name: extension-package
89+
path: packages/
90+
91+
- name: Create GitHub Release
92+
run: |
93+
VERSION=$(git describe --tags --abbrev=0)
94+
95+
TAG_MESSAGE=$(git tag -l --format='%(contents)' "$VERSION")
96+
97+
if [ -n "$TAG_MESSAGE" ]; then
98+
TAG_VERSION=$(echo "$TAG_MESSAGE" | head -1 | sed 's/Release //' | sed 's/^[[:space:]]*//')
99+
if [ -z "$TAG_VERSION" ] || [ "$TAG_VERSION" = "$TAG_MESSAGE" ]; then
100+
TAG_VERSION=${VERSION#v}
101+
fi
102+
103+
CHANGELOG_ITEMS=$(echo "$TAG_MESSAGE" | grep "^-" || echo "$TAG_MESSAGE" | sed -n '/Changelog:/,//p' | grep "^-")
104+
105+
RELEASE_NOTES="## Release $TAG_VERSION
106+
107+
### Changelog
108+
$CHANGELOG_ITEMS"
109+
else
110+
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
111+
if [ -n "$PREVIOUS_TAG" ]; then
112+
COMMITS=$(git log --oneline --pretty=format:"- %s" "$PREVIOUS_TAG..HEAD")
113+
else
114+
COMMITS=$(git log --oneline --pretty=format:"- %s")
115+
fi
116+
117+
RELEASE_NOTES="## Release ${VERSION#v}
118+
119+
### Changelog
120+
$COMMITS"
121+
fi
122+
123+
gh release create "$VERSION" packages/*.zip \
124+
--title "${VERSION#v}" \
125+
--notes "$RELEASE_NOTES"
94126
env:
95127
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)