Skip to content

Commit

Permalink
Merge pull request #509 from desktop/fix-releases
Browse files Browse the repository at this point in the history
Replace deprecated create release action
  • Loading branch information
niik authored May 22, 2024
2 parents 9e9adcc + df8a2a5 commit 1074931
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 48 deletions.
36 changes: 8 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,33 +156,27 @@ jobs:
release:
name: Create GitHub release
needs: [build, shellcheck]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
with:
path: './artifacts'

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

- name: Get tag name without prefix
run: |
DUGITE_TAG=${GITHUB_REF/refs\/tags\//}
echo "DUGITE_TAG=${DUGITE_TAG}" >> $GITHUB_ENV
tagNameWithoutPrefix="${DUGITE_TAG:1}"
echo "DUGITE_TAG_WITHOUT_PREFIX=${tagNameWithoutPrefix}" >> $GITHUB_ENV
- name: Generate release notes
run: |
npm ci
node -r ts-node/register script/generate-release-notes.ts "${{ github.workspace }}/artifacts" "${{ env.DUGITE_TAG }}" "${{ secrets.GITHUB_TOKEN }}"
DUGITE_TAG=${GITHUB_REF/refs\/tags\//}
node -r ts-node/register script/generate-release-notes.ts "${{ github.workspace }}/artifacts" "$DUGITE_TAG" "${{ secrets.GITHUB_TOKEN }}"
RELEASE_NOTES_FILE=script/release_notes.txt
if [[ ! -f "$RELEASE_NOTES_FILE" ]]; then
echo "$RELEASE_NOTES_FILE does not exist. Something might have gone wrong while generating the release notes."
Expand All @@ -192,25 +186,11 @@ jobs:
cat ${RELEASE_NOTES_FILE} >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref }}
release_name: Git ${{ env.DUGITE_TAG_WITHOUT_PREFIX }}
body: ${{ env.DUGITE_RELEASE_NOTES }}
draft: true
prerelease: false

- name: Upload release assets
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# Workaround since actions/upload-release-asset doesn't support wildcard paths
script: |
const script = require(`${process.env.GITHUB_WORKSPACE}/script/create-release.js`);
const artifactsDir = `${process.env.GITHUB_WORKSPACE}/artifacts`;
const releaseId = '${{ steps.create_release.outputs.id }}';
console.log(script({github, context, artifactsDir, releaseId}));
files: ${{ github.workspace }}/artifacts/**/*
fail_on_unmatched_files: true
20 changes: 0 additions & 20 deletions script/create-release.js

This file was deleted.

0 comments on commit 1074931

Please sign in to comment.