From 0ab0a11eea969020e5d9079bc9b0fdc9fac95093 Mon Sep 17 00:00:00 2001 From: badaix Date: Sun, 18 Aug 2024 21:54:03 +0200 Subject: [PATCH] Create draft release --- .github/workflows/package.yml | 156 ++++++++++++++++++---------- changelog.md | 7 +- extras/changelog_current_version.py | 42 ++++++++ 3 files changed, 145 insertions(+), 60 deletions(-) create mode 100755 extras/changelog_current_version.py diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index a9947c23..e3eb9a4b 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -4,13 +4,45 @@ run-name: Package ${{ github.sha }} by @${{ github.actor }} on: workflow_dispatch: +permissions: + contents: write + env: BOOST_VERSION: 1_85_0 SNAPWEB_VERSION: v0.8.0 jobs: + release: + runs-on: ubuntu-latest + name: Create release + outputs: + tag: ${{ steps.draft_release.outputs.tag }} + steps: + - name: Get dependencies + run: sudo apt-get update && sudo apt-get install -yq python3 + env: + DEBIAN_FRONTEND: noninteractive + - name: Checkout + uses: actions/checkout@v4 + - name: Create release notes + run: $GITHUB_WORKSPACE/extras/changelog_current_version.py $GITHUB_WORKSPACE/changelog.md > $GITHUB_WORKSPACE/changelog_current.md + - name: Create draft release + id: draft_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + URL=$( \ + gh release create v0.0.0 \ + --draft \ + --repo="$GITHUB_REPOSITORY" \ + --title="Snapcast v0.0.0" \ + --notes-file changelog_current.md \ + ) + echo "tag=$(basename $URL)" >> $GITHUB_OUTPUT + deb: + needs: release strategy: fail-fast: false matrix: @@ -43,6 +75,15 @@ jobs: run: apt-get update && apt-get install -yq wget debhelper build-essential cmake git rename libatomic1 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libpulse-dev libavahi-client-dev avahi-daemon libexpat1-dev python3 ccache unzip env: DEBIAN_FRONTEND: noninteractive + - name: Get GitHub cli + run: | + (type -p wget >/dev/null || (apt update && apt-get install wget -y)) \ + && mkdir -p -m 755 /etc/apt/keyrings \ + && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ + && chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ + && apt update \ + && apt install gh -y - name: Checkout uses: actions/checkout@v4 - name: Setup environment @@ -57,7 +98,7 @@ jobs: $GITHUB_WORKSPACE/debian/changelog_md2deb.py $GITHUB_WORKSPACE/changelog.md > $GITHUB_WORKSPACE/debian/changelog cat $GITHUB_WORKSPACE/debian/changelog - name: Clean up - run: rm -rf ${{env.PARENT_DIR}}/snap*_${{ matrix.arch }}.deb + run: rm -rf ${{env.PARENT_DIR}}/snap*_*.deb - name: Cache boost id: cache-boost uses: actions/cache@v4 @@ -87,15 +128,66 @@ jobs: CCACHE_DIR: /home/runner/.ccache run: | fakeroot make -f debian/rules CMAKEFLAGS="-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBOOST_ROOT=$GITHUB_WORKSPACE/${{env.BOOST}} -DCMAKE_BUILD_TYPE:STRING=Release -DREVISION=${{ github.sha }} -DBUILD_WITH_JACK=OFF -DBUILD_WITH_PULSE=OFF -DSNAPWEB_DIR:STRING=$GITHUB_WORKSPACE/snapweb" binary - rename 's/_${{ matrix.arch }}/_without-pulse_${{ matrix.arch }}/g' ../snapclient*_${{ matrix.arch }}.deb + rename 's/_${{ matrix.arch }}/_${{ matrix.arch }}_${{ matrix.debian }}/g' ../snap*_${{ matrix.arch }}.deb fakeroot make -f debian/rules clean fakeroot make -f debian/rules CMAKEFLAGS="-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBOOST_ROOT=$GITHUB_WORKSPACE/${{env.BOOST}} -DCMAKE_BUILD_TYPE:STRING=Release -DREVISION=${{ github.sha }} -DBUILD_WITH_JACK=OFF -DSNAPWEB_DIR:STRING=$GITHUB_WORKSPACE/snapweb" binary - - name: Archive artifacts - uses: actions/upload-artifact@v4 - with: - name: snapcast_${{ matrix.arch }}-debian-${{matrix.debian}}-${{ github.sha }} - path: ${{env.PARENT_DIR}}/snap*_${{ matrix.arch }}.deb + rm ../snapserver_*_${{ matrix.arch }}.deb + rename 's/_${{ matrix.arch }}/_${{ matrix.arch }}_${{ matrix.debian }}_with-pulse/g' ../snap*_${{ matrix.arch }}.deb + - name: Release artifacts + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git config --global --add safe.directory $GITHUB_WORKSPACE + gh release upload ${{needs.release.outputs.tag}} ${{env.PARENT_DIR}}/snap*_*.deb + + win: + needs: release + runs-on: windows-2019 + name: win + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Checkout Snapcast + uses: actions/checkout@v4 + with: + repository: badaix/snapcast + path: src/snapcast + ref: ${{ env.VERSION }} + - name: Cache dependencies + id: cache-dependencies + uses: actions/cache@v4 + with: + #path: ${VCPKG_INSTALLATION_ROOT}\installed + path: c:\vcpkg\installed + key: ${{ runner.os }}-dependencies + - name: Get dependenciesenv + if: steps.cache-dependencies.outputs.cache-hit != 'true' + run: vcpkg.exe install libflac libvorbis soxr opus boost-asio --triplet x64-windows + - name: configure + run: | + echo vcpkg installation root: $env:VCPKG_INSTALLATION_ROOT + cmake -S . -B build -G "Visual Studio 16 2019" -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET="x64-windows" -DCMAKE_BUILD_TYPE="Release" -DREVISION="${{ github.sha }}" -DWERROR=ON -DBUILD_TESTS=ON + - name: build + run: cmake --build build --config Release --parallel 3 --verbose + - name: installer + run: | + mkdir bundle + copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\FLAC.dll bundle\ + copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\ogg.dll bundle\ + copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\opus.dll bundle\ + copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\vorbis.dll bundle\ + copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\soxr.dll bundle\ + copy "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\v142\vc_redist.x64.exe" bundle\ + copy bin\Release\snapclient.exe bundle\ + Compress-Archive -Path bundle\* -Destination snapcast_win64.zip + - name: Release artifacts + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git config --global --add safe.directory . + gh release upload ${{needs.release.outputs.tag}} snapcast_win64.zip # mac: # strategy: @@ -194,53 +286,3 @@ jobs: # name: snapcast_${{ matrix.arch }}-fedora-${{matrix.image}}-${{ github.sha }} # path: ~/rpmbuild/RPMS/${{ matrix.arch }}/snap*.rpm - - win: - runs-on: windows-2019 - name: win - - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Checkout Snapcast - uses: actions/checkout@v4 - with: - repository: badaix/snapcast - path: src/snapcast - ref: ${{ env.VERSION }} - - name: Cache dependencies - id: cache-dependencies - uses: actions/cache@v4 - with: - #path: ${VCPKG_INSTALLATION_ROOT}\installed - path: c:\vcpkg\installed - key: ${{ runner.os }}-dependencies - - name: Get dependenciesenv - if: steps.cache-dependencies.outputs.cache-hit != 'true' - run: vcpkg.exe install libflac libvorbis soxr opus boost-asio --triplet x64-windows - - name: configure - run: | - echo vcpkg installation root: $env:VCPKG_INSTALLATION_ROOT - cmake -S . -B build -G "Visual Studio 16 2019" -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET="x64-windows" -DCMAKE_BUILD_TYPE="Release" -DREVISION="${{ github.sha }}" -DWERROR=ON -DBUILD_TESTS=ON - - name: build - run: cmake --build build --config Release --parallel 3 --verbose - - name: installer - run: | - copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\FLAC.dll bin\Release\ - copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\ogg.dll bin\Release\ - copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\opus.dll bin\Release\ - copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\vorbis.dll bin\Release\ - copy ${env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows\bin\soxr.dll bin\Release\ - copy "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\v142\vc_redist.x64.exe" bin\Release\ - - name: Archive artifacts - uses: actions/upload-artifact@v4 - with: - name: snapcast_win64-${{ github.sha }} - path: | - bin\Release\snapclient.exe - bin\Release\FLAC.dll - bin\Release\ogg.dll - bin\Release\opus.dll - bin\Release\vorbis.dll - bin\Release\soxr.dll - bin\Release\vc_redist.x64.exe diff --git a/changelog.md b/changelog.md index 4aae9173..cf675105 100644 --- a/changelog.md +++ b/changelog.md @@ -9,14 +9,15 @@ ### Bugfixes -- Fix linker paths for ARM based MacOS +- Fix linker paths on ARM based MacOS ### General -- CI: Add clang 16, 17, 18, gcc 14, xcode 15.1, 15.2, 15.3, 15.4 - Snapweb: Update to v0.8.0 +- CI: Add clang 16, 17, 18, gcc 14, xcode 15.1, 15.2, 15.3, 15.4 +- CI: Create GitHub draft release -_Johannes Pohl Sun, 11 Aug 2024 00:13:37 +0200_ +_Johannes Pohl Sun, 25 Aug 2024 00:13:37 +0200_ ## Version 0.28.0 diff --git a/extras/changelog_current_version.py b/extras/changelog_current_version.py new file mode 100755 index 00000000..a044ac63 --- /dev/null +++ b/extras/changelog_current_version.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# This file is part of snapcast +# Copyright (C) 2022-2024 Johannes Pohl +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import sys +import re + +if __name__ == "__main__": + if len(sys.argv) != 2: + print(f"Usage: changelog_current_version.py ") + sys.exit(1) + + data = "" + start_found = False + with open(sys.argv[1], 'r') as file: + for line in file: + if line.startswith("_"): + break + if not start_found: + start_found = line.startswith("## Version ") + if not start_found: + continue + if line.startswith("##"): + line = line[1:] + data += line + + print(data)