Skip to content

Commit

Permalink
Merge pull request #919 from dsm/current
Browse files Browse the repository at this point in the history
some improvements for release creation in CI.
  • Loading branch information
ra3xdh authored Aug 29, 2024
2 parents 16d41ec + f4164ee commit a5f4223
Showing 1 changed file with 52 additions and 58 deletions.
110 changes: 52 additions & 58 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,20 @@ jobs:
- name: 'Install linuxdeploy'
run: |
wget -q --tries=3 --wait=5 https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
wget -q --tries=3 --wait=5 https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
wget -q --tries=3 --wait=5 \
https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
wget -q --tries=3 --wait=5 \
https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
sudo apt-get install fuse libfuse2
chmod +x linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-plugin-qt-x86_64.AppImage
- name: 'Create AppImage'
run: |
./linuxdeploy-x86_64.AppImage --appdir ${{github.workspace}}/AppDir --desktop-file=${{github.workspace}}/AppDir/usr/share/applications/qucs-s.desktop --icon-file=${{github.workspace}}/AppDir/usr/share/icons/hicolor/256x256/apps/qucs-s.png --plugin=qt --output appimage
./linuxdeploy-x86_64.AppImage --appdir ${{github.workspace}}/AppDir \
--desktop-file=${{github.workspace}}/AppDir/usr/share/applications/qucs-s.desktop \
--icon-file=${{github.workspace}}/AppDir/usr/share/icons/hicolor/256x256/apps/qucs-s.png \
--plugin=qt --output appimage
rm linuxdeploy-x86_64.AppImage
rm linuxdeploy-plugin-qt-x86_64.AppImage
mv *.AppImage ${{ env.APP_NAME }}-${{env.VERSION}}-linux-x86_64.AppImage
Expand Down Expand Up @@ -163,12 +168,6 @@ jobs:
- name: 'Build Qucs-s'
run: |
cmake --build ${{github.workspace}}/build --parallel --config=${{env.BUILD_TYPE}}
#- name: Install
# run: |
# cd build
# make install DESTDIR=./deploy
# cd ..
- name: 'Package App Bundle'
run: |
Expand Down Expand Up @@ -258,12 +257,6 @@ jobs:
- name: 'Build Qucs-s'
run: |
cmake --build ${{github.workspace}}/build --parallel --config=${{env.BUILD_TYPE}}
#- name: Install
# run: |
# cd build
# make install DESTDIR=./deploy
# cd ..
- name: 'Package App Bundle'
run: |
Expand Down Expand Up @@ -306,7 +299,6 @@ jobs:
needs: setup
strategy:
fail-fast: false

defaults:
run:
shell: msys2 {0}
Expand Down Expand Up @@ -427,20 +419,22 @@ jobs:
create-release:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
needs:
- setup
- build-linux-appimage-qt6
- build-mac-intel
- build-mac-universal
- build-windows
needs: [setup, build-linux-appimage-qt6, build-mac-intel, build-mac-universal, build-windows]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set version environment variable
run: echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV

- name: Print version
run: echo "Qucs-S version is ${{ env.VERSION }}"

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: ~/artifacts
merge-multiple: true

- name: Calculate SHA-256 checksums
run: |
Expand All @@ -451,58 +445,58 @@ jobs:
sha256sum "$file" | awk -v fname="$filename" '{print $1 " *" fname}' >> hashes.sha256
done
cd ..
tree ~/artifacts
- name: Check if continuous_build release exists
- name: Setup Release Information
run: |
if [ "${{github.ref_type}}" == "tag" ]; then
if gh release view ${{ github.ref_name }} --repo $GITHUB_REPOSITORY &> /dev/null; then
gh release delete ${{ github.ref_name }} --repo $GITHUB_REPOSITORY
fi
elif [ "${{github.ref_type}}" == "branch" ]; then
if gh release view continuous_build --repo $GITHUB_REPOSITORY &> /dev/null; then
gh release delete continuous_build --repo $GITHUB_REPOSITORY --cleanup-tag --yes
fi
echo "PRERELEASE=" >> $GITHUB_ENV
echo "RELEASE_NAME=Qucs-S ${{ github.ref_name }}" >> $GITHUB_ENV
echo "TAG_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
echo "RELEASE_NOTES=--generate-notes" >> $GITHUB_ENV
else
echo "PRERELEASE=-p" >> $GITHUB_ENV
echo "RELEASE_NAME=Continuous Build" >> $GITHUB_ENV
echo "TAG_NAME=continuous_build" >> $GITHUB_ENV
echo "RELEASE_NOTES=--notes \"Automated release for commit ${{ github.sha }}\"" >> $GITHUB_ENV
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create GitHub Release
continue-on-error: false
run: |
# Find existing zip and dmg files
# Find existing artifact files
hash_files=$(find ~/artifacts -name "*.sha256" -print0 | xargs -0 echo)
exe_files=$(find ~/artifacts -name "*.exe" -print0 | xargs -0 echo)
zip_files=$(find ~/artifacts -name "*.zip" -print0 | xargs -0 echo)
dmg_files=$(find ~/artifacts -name "*.dmg" -print0 | xargs -0 echo)
appimage_files=$(find ~/artifacts -name "*.AppImage" -print0 | xargs -0 echo)
# Create release only if there are files to upload
if [ -n "$exe_files" ] && [ -n "$zip_files" ] && [ -n "$dmg_files" ] && [ -n "$appimage_files" ]; then
if [ "${{github.ref_type}}" != "tag" ]; then
gh release create continuous_build \
$exe_files \
$zip_files \
$dmg_files \
$appimage_files \
~/artifacts/hashes.sha256 \
-p \
--repo $GITHUB_REPOSITORY \
--title "Continuous build" \
--notes "Automated release for commit ${{ github.sha }}"
# Check existing release and delete if it's exist
if gh release view ${{ env.TAG_NAME }} --repo $GITHUB_REPOSITORY &> /dev/null; then
if [ "${{ env.TAG_NAME }}" == "continuous_build" ]; then
gh release delete ${{ env.TAG_NAME }} --repo $GITHUB_REPOSITORY --cleanup-tag --yes
else
gh release create ${{ github.ref_name }} \
$exe_files \
$zip_files \
$dmg_files \
$appimage_files \
~/artifacts/hashes.sha256 \
--repo $GITHUB_REPOSITORY \
--title "Qucs-S ${{ github.ref_name }}" \
--generate-notes\
--verify-tag
gh release delete ${{ env.TAG_NAME }} --repo $GITHUB_REPOSITORY
fi
echo "${{ env.TAG_NAME }} deleted!"
fi
if [ -n "$exe_files" ] && [ -n "$zip_files" ] && [ -n "$dmg_files" ] && [ -n "$appimage_files" ]; then
gh release create ${{ env.TAG_NAME }} \
$exe_files \
$zip_files \
$dmg_files \
$appimage_files \
$hash_files \
${{ env.PRERELEASE }} \
--repo $GITHUB_REPOSITORY \
--title "${{ env.RELEASE_NAME }}" \
${{ env.RELEASE_NOTES }}
echo "${{ env.TAG_NAME }} release created!"
else
echo "No artifacts to upload."
exit 1
fi
env:
Expand Down

0 comments on commit a5f4223

Please sign in to comment.