Skip to content

Commit 1074931

Browse files
authored
Merge pull request #509 from desktop/fix-releases
Replace deprecated create release action
2 parents 9e9adcc + df8a2a5 commit 1074931

File tree

2 files changed

+8
-48
lines changed

2 files changed

+8
-48
lines changed

.github/workflows/ci.yml

+8-28
Original file line numberDiff line numberDiff line change
@@ -156,33 +156,27 @@ jobs:
156156
release:
157157
name: Create GitHub release
158158
needs: [build, shellcheck]
159-
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
159+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
160160
runs-on: ubuntu-latest
161161
permissions:
162162
contents: write
163163
steps:
164164
- uses: actions/checkout@v4
165165

166166
- name: Download all artifacts
167-
uses: actions/download-artifact@v4
167+
uses: actions/download-artifact@v3
168168
with:
169169
path: './artifacts'
170170

171171
- name: Display structure of downloaded files
172172
run: ls -R
173173
working-directory: './artifacts'
174174

175-
- name: Get tag name without prefix
176-
run: |
177-
DUGITE_TAG=${GITHUB_REF/refs\/tags\//}
178-
echo "DUGITE_TAG=${DUGITE_TAG}" >> $GITHUB_ENV
179-
tagNameWithoutPrefix="${DUGITE_TAG:1}"
180-
echo "DUGITE_TAG_WITHOUT_PREFIX=${tagNameWithoutPrefix}" >> $GITHUB_ENV
181-
182175
- name: Generate release notes
183176
run: |
184177
npm ci
185-
node -r ts-node/register script/generate-release-notes.ts "${{ github.workspace }}/artifacts" "${{ env.DUGITE_TAG }}" "${{ secrets.GITHUB_TOKEN }}"
178+
DUGITE_TAG=${GITHUB_REF/refs\/tags\//}
179+
node -r ts-node/register script/generate-release-notes.ts "${{ github.workspace }}/artifacts" "$DUGITE_TAG" "${{ secrets.GITHUB_TOKEN }}"
186180
RELEASE_NOTES_FILE=script/release_notes.txt
187181
if [[ ! -f "$RELEASE_NOTES_FILE" ]]; then
188182
echo "$RELEASE_NOTES_FILE does not exist. Something might have gone wrong while generating the release notes."
@@ -192,25 +186,11 @@ jobs:
192186
cat ${RELEASE_NOTES_FILE} >> $GITHUB_ENV
193187
echo 'EOF' >> $GITHUB_ENV
194188
195-
- name: Create release
196-
id: create_release
197-
uses: actions/create-release@v1
198-
env:
199-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
189+
- name: Release
190+
uses: softprops/action-gh-release@v2
200191
with:
201-
tag_name: ${{ github.ref }}
202-
release_name: Git ${{ env.DUGITE_TAG_WITHOUT_PREFIX }}
203192
body: ${{ env.DUGITE_RELEASE_NOTES }}
204193
draft: true
205194
prerelease: false
206-
207-
- name: Upload release assets
208-
uses: actions/github-script@v3
209-
with:
210-
github-token: ${{ secrets.GITHUB_TOKEN }}
211-
# Workaround since actions/upload-release-asset doesn't support wildcard paths
212-
script: |
213-
const script = require(`${process.env.GITHUB_WORKSPACE}/script/create-release.js`);
214-
const artifactsDir = `${process.env.GITHUB_WORKSPACE}/artifacts`;
215-
const releaseId = '${{ steps.create_release.outputs.id }}';
216-
console.log(script({github, context, artifactsDir, releaseId}));
195+
files: ${{ github.workspace }}/artifacts/**/*
196+
fail_on_unmatched_files: true

script/create-release.js

-20
This file was deleted.

0 commit comments

Comments
 (0)