Skip to content

Commit

Permalink
introduce separate publish step which runs after build (#899 #900)
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftkey committed Aug 11, 2024
1 parent 017ceb4 commit 86df39d
Show file tree
Hide file tree
Showing 4 changed files with 374 additions and 14 deletions.
80 changes: 66 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- 'linux-release-*'
tags:
- 'release-*.*.*-linux*'
- 'release-*.*.*-test*'
pull_request:
branches:
- linux
Expand Down Expand Up @@ -194,20 +195,6 @@ jobs:
- name: Package application
run: yarn run package
if: ${{ matrix.friendlyName == 'Ubuntu' }}
- name: Create Release
uses: softprops/action-gh-release@v1
if:
${{ matrix.friendlyName == 'Ubuntu' && startsWith(github.ref,
'refs/tags/') }}
with:
files: |
dist/*.AppImage
dist/*.deb
dist/*.rpm
dist/*.txt
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload output artifacts
uses: actions/upload-artifact@v3
if: matrix.friendlyName == 'Ubuntu'
Expand All @@ -217,4 +204,69 @@ jobs:
dist/*.AppImage
dist/*.deb
dist/*.rpm
dist/*.sha256
retention-days: 5

publish:
name: Create GitHub release
needs: [build, lint]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- uses: actions/checkout@v3

- name: Use Node.js 18.14.0
uses: actions/setup-node@v3
with:
node-version: 18.14.0
cache: yarn

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

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

- name: Get tag name without prefix
run: |
RELEASE_TAG=${GITHUB_REF/refs\/tags\//}
echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV
tagNameWithoutPrefix="${RELEASE_TAG:1}"
echo "RELEASE_TAG_WITHOUT_PREFIX=${tagNameWithoutPrefix}" >> $GITHUB_ENV
# TODO: generate release notes
# - pull in default if version matches X.Y.Z-linux1
# - otherwise stub template

- name: Generate release notes
run: |
node -v
yarn
node -r ts-node/register script/generate-release-notes.ts "${{ github.workspace }}/artifacts" "${{ env.RELEASE_TAG_WITHOUT_PREFIX }}"
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."
exit 1
fi
echo "Release notes:"
echo "---"
cat ${RELEASE_NOTES_FILE}
echo "---"
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: GitHub Desktop for Linux ${{ env.RELEASE_TAG_WITHOUT_PREFIX }}
body_path: script/release_notes.txt
files: |
artifacts/*.AppImage
artifacts/*.deb
artifacts/*.rpm
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ vendor/windows-argv-parser/build/
junit*.xml
*.swp
tslint-rules/
script/release_notes.txt
Loading

0 comments on commit 86df39d

Please sign in to comment.