Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated create release action #509

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading