Bump version #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
# Based on https://github.com/ra3xdh/qucs_s/.github/workflows/deploy.yml | |
on: | |
push: | |
tags: | |
- '*' | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
jobs: | |
build-debian-packages: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
os_name: ['bullseye', 'bookworm', 'trixie'] | |
container: | |
# https://hub.docker.com/_/debian | |
image: debian:${{matrix.os_name}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Install Dependencies' | |
shell: bash | |
run: | | |
apt-get update | |
# https://serverfault.com/a/992421 | |
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y build-essential qtbase5-dev qttools5-dev-tools libqt5serialport5-dev | |
- name: 'Build' | |
shell: bash | |
run: install/deb-build.sh -s debian-${{matrix.os_name}} -v ${{ github.ref_name }} | |
- name: 'Upload debian packages' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: debian-${{matrix.os_name}} | |
path: '*.deb' | |
build-ubuntu-packages: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
os_name: ['focal', 'jammy', 'mantic', 'noble'] | |
container: | |
# https://hub.docker.com/_/ubuntu | |
image: ubuntu:${{matrix.os_name}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Install Dependencies' | |
shell: bash | |
run: | | |
apt-get update | |
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y build-essential qtbase5-dev qttools5-dev-tools libqt5serialport5-dev | |
- name: 'Build' | |
shell: bash | |
run: install/deb-build.sh -s ubuntu-${{matrix.os_name}} -v ${{ github.ref_name }} | |
- name: 'Upload ubuntu packages' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ubuntu-${{matrix.os_name}} | |
path: '*.deb' | |
build-windows-installer: | |
runs-on: windows-2022 | |
strategy: | |
fail-fast: false | |
matrix: | |
msystem: ['mingw64', 'mingw32'] | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- name: Disable autocrlf in Git | |
shell: pwsh | |
# https://github.com/msys2/setup-msys2?tab=readme-ov-file#actionscheckout-and-line-endings | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up MSYS2 environment | |
# The qt5-serialport package is now missing from mingw32, so we use | |
# a static build. The openssl package is needed for qt-static, but it is | |
# not in the qt5-static dependencies and so has to be installed explicitly. | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{matrix.msystem}} | |
cache: true | |
update: true | |
install: >- | |
make | |
zip | |
pacboy: >- | |
gcc:p | |
nsis:p | |
qt5-static:p | |
openssl:p | |
- name: 'Build' | |
run: install/win-msys2-build.sh -s windows -v ${{ github.ref_name }} -q /${{matrix.msystem}}/qt5-static/bin/qmake.exe | |
- name: 'Upload windows installers' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-${{matrix.msystem}} | |
path: | | |
*.exe | |
*.zip | |
create-release: | |
runs-on: ubuntu-latest | |
needs: [build-debian-packages, build-ubuntu-packages, build-windows-installer] | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: ~/artifacts | |
merge-multiple: true | |
- name: Calculate SHA-256 checksums | |
run: | | |
cd ~/artifacts | |
echo 'SHA-256 checksums' > notes.txt | |
echo '-----------------' >> notes.txt | |
echo -e '\n```' >> notes.txt | |
for file in $(find . -type f \( -name "*.exe" -o -name "*.zip" -o -name "*.deb" -o -name "*.rpm" \) | sort); do | |
filename=$(basename "$file") | |
checksum=$(sha256sum "$file" | awk '{print $1}') | |
echo "$checksum $filename" >> notes.txt | |
#echo $checksum > "$filename".sha256 | |
done | |
echo -e '```\n' >> notes.txt | |
cd .. | |
tree ~/artifacts | |
- name: Setup Release Information | |
run: | | |
echo "RELEASE_NAME=${{ github.ref_name }}" >> $GITHUB_ENV | |
echo "TAG_NAME=${{ github.ref_name }}" >> $GITHUB_ENV | |
- name: Create GitHub Release | |
continue-on-error: false | |
run: | | |
# 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) | |
deb_files=$(find ~/artifacts -name "*.deb" -print0 | xargs -0 echo) | |
rpm_files=$(find ~/artifacts -name "*.rpm" -print0 | xargs -0 echo) | |
# Check existing release and delete if it's exist | |
if gh release view ${{ env.TAG_NAME }} --repo $GITHUB_REPOSITORY &> /dev/null; then | |
gh release delete ${{ env.TAG_NAME }} --repo $GITHUB_REPOSITORY | |
echo "${{ env.TAG_NAME }} deleted!" | |
fi | |
gh release create ${{ env.TAG_NAME }} \ | |
--repo $GITHUB_REPOSITORY \ | |
--draft \ | |
--title "${{ env.RELEASE_NAME }}" \ | |
--notes-file ~/artifacts/notes.txt \ | |
$hash_files \ | |
$exe_files \ | |
$zip_files \ | |
$deb_files \ | |
$rpm_files | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |