Skip to content

Commit

Permalink
Replace deprecated action and custom upload script with maintained ac…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
niik committed May 22, 2024
1 parent 9e9adcc commit 0673a18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 47 deletions.
34 changes: 7 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ 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
Expand All @@ -172,17 +172,11 @@ jobs:
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 0673a18

Please sign in to comment.