Skip to content

Commit 7b7bb07

Browse files
committed
🔧 update outdated GH Action
1 parent bad8092 commit 7b7bb07

File tree

1 file changed

+26
-79
lines changed

1 file changed

+26
-79
lines changed

‎.github/workflows/release.yml‎

Lines changed: 26 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
default: "true"
1414
required: true
1515

16+
env:
17+
GH_BOT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
18+
GH_BOT_NAME: "GitHub Action"
19+
1620
jobs:
1721
build:
1822
runs-on: ubuntu-latest
@@ -36,8 +40,8 @@ jobs:
3640
run: |
3741
echo "${{ github.event.inputs.version }}"
3842
echo "${{ github.event.inputs.update-manifest }}"
39-
git config user.name github-actions
40-
git config user.email github-actions@github.com
43+
git config user.name ${{ env.GH_BOT_NAME }}
44+
git config user.email ${{ env.GH_BOT_EMAIL }}
4145
4246
npm install
4347
npm version ${{ github.event.inputs.version }} --no-git-tag-version
@@ -47,6 +51,7 @@ jobs:
4751
if [ "${{ github.event.inputs.update-manifest }}" = "true" ]; then
4852
sed -i 's|\(version":\) "[0-9\.]*"|\1 "'$VERSION'"|' manifest.json
4953
fi
54+
sed -i 's|\(version":\) "[0-9\.]*"|\1 "'$VERSION'"|' manifest-beta.json
5055
5156
git add .
5257
git status
@@ -57,94 +62,36 @@ jobs:
5762
git push --tags
5863
5964
npm run brat-notes -- ${VERSION}
60-
echo "::set-output name=version::${VERSION}"
65+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
6166
6267
# Package the required files into a zip
6368
- name: Package
6469
run: |
6570
mkdir ${{ github.event.repository.name }}
6671
cp ./build/* ${{ github.event.repository.name }}
67-
zip -r ${{ github.event.repository.name }}.zip ${{ github.event.repository.name }}
72+
zip -r ${{ github.event.repository.name }}-${{ steps.build.outputs.version }}.zip ${{ github.event.repository.name }}
6873
6974
# Create the release on github
7075
- name: Create Release
7176
id: create_release
72-
uses: actions/create-release@v1
73-
env:
74-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75-
VERSION: ${{ steps.build.outputs.version }}
76-
with:
77-
tag_name: ${{ steps.build.outputs.version }}
78-
release_name: Release ${{ steps.build.outputs.version }}
79-
body_path: ./release-notes.md
80-
draft: false
81-
prerelease: false
82-
83-
# Upload the packaged release file
84-
- name: Upload zip file
85-
id: upload-zip
86-
uses: actions/upload-release-asset@v1
87-
env:
88-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89-
with:
90-
upload_url: ${{ steps.create_release.outputs.upload_url }}
91-
asset_path: ./${{ github.event.repository.name }}.zip
92-
asset_name: ${{ github.event.repository.name }}-${{ steps.build.outputs.version }}.zip
93-
asset_content_type: application/zip
94-
95-
# Upload main.js
96-
- name: Upload main.js
97-
id: upload-main
98-
uses: actions/upload-release-asset@v1
9977
env:
10078
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101-
with:
102-
upload_url: ${{ steps.create_release.outputs.upload_url }}
103-
asset_path: ./build/main.js
104-
asset_name: main.js
105-
asset_content_type: text/javascript
106-
107-
# Upload styles.css
108-
- name: Upload styles.css
109-
id: upload-css
110-
uses: actions/upload-release-asset@v1
111-
env:
112-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113-
with:
114-
upload_url: ${{ steps.create_release.outputs.upload_url }}
115-
asset_path: ./build/styles.css
116-
asset_name: styles.css
117-
asset_content_type: text/css
118-
119-
# Upload manifest.json
120-
- name: Upload manifest.json
121-
id: upload-manifest
122-
uses: actions/upload-release-asset@v1
123-
env:
124-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125-
with:
126-
upload_url: ${{ steps.create_release.outputs.upload_url }}
127-
asset_path: ./manifest.json
128-
asset_name: manifest.json
129-
asset_content_type: application/json
130-
131-
brat:
132-
needs: build
133-
runs-on: ubuntu-latest
134-
steps:
135-
- uses: actions/checkout@v2
136-
with:
137-
ref: main
138-
- env:
139-
VERSION: ${{needs.build.outputs.version}}
14079
run: |
141-
echo $VERSION
142-
mversion=$(grep 'version' manifest-beta.json | cut -d'"' -f4)
143-
if [ "$VERSION" != "$mversion" ]; then
144-
sed -i 's|\(version":\) "[0-9\.]*"|\1 "'$VERSION'"|' manifest-beta.json
145-
git config user.name github-actions
146-
git config user.email github-actions@github.com
147-
git add .
148-
git commit -m "🔨 brat release $VERSION"
149-
git push
80+
prerelease=true
81+
if [ "${{ github.event.inputs.update-manifest }}" = "true" ]; then
82+
prerelease=false
15083
fi
84+
85+
gh release create "${{ steps.build.outputs.version }}" \
86+
-F ./release-notes.md \
87+
--title "Release ${{ steps.build.outputs.version }}" \
88+
--discussion-category "Announcements" \
89+
--verify-tag \
90+
--prerelease=${prerelease}
91+
92+
gh release upload "${{ steps.build.outputs.version }}" --clobber \
93+
${{ github.event.repository.name }}-${{ steps.build.outputs.version }}.zip \
94+
'./build/main.js#main.js' \
95+
'./build/styles.css#styles.css' \
96+
'./manifest.json' \
97+
'./manifest-beta.json'

0 commit comments

Comments
 (0)