From 23eb9ee5512ce0a4ef1c72177b3a1d012221581c Mon Sep 17 00:00:00 2001 From: Alexander Volz Date: Tue, 7 Sep 2021 20:59:34 +0200 Subject: [PATCH] added ci --- .github/workflows/build_release.yml | 75 +++++++++++++++++++++++++++++ .gitignore | 3 +- README.md | 4 +- 3 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/build_release.yml diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml new file mode 100644 index 0000000..c2680a6 --- /dev/null +++ b/.github/workflows/build_release.yml @@ -0,0 +1,75 @@ +name: volumehidtoosc_build_release + +on: + push: + branches: + - main + tags: [ v**] + paths: + - '**' + - '!Docs/**' + - '!README.md' + pull_request: + branches: + - main + tags: [ v**] + paths: + - '**' + - '!Docs/**' + - '!README.md' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v2 + - name: set Version + if: ${{ (startsWith(github.ref, 'refs/tags/v')) }} + run: echo "VOLUMEHIDTOOSCDVER=$(echo ${GITHUB_REF} | sed 's|refs/heads/||g' | sed 's|refs/tags/v||g' | sed 's|-beta||g' )" >> $GITHUB_ENV + - name: set Version + if: ${{ !(startsWith(github.ref, 'refs/tags/v')) }} + run: echo "VOLUMEHIDTOOSCDVER=1.0.0-1" >> $GITHUB_ENV + - name: set majorVersion + run: echo "VOLUMEHIDTOOSCDMAJORVER=$(echo $VOLUMEHIDTOOSCDVER | sed 's|-.*$||g' | cut -d. -f1 )" >> $GITHUB_ENV + - name: set minorVersion + run: echo "VOLUMEHIDTOOSCDMINORVER=$(echo $VOLUMEHIDTOOSCDVER | sed 's|-.*$||g' | cut -d. -f2 )" >> $GITHUB_ENV + - name: set patchVersion + run: echo "VOLUMEHIDTOOSCDPATCHVER=$(echo $VOLUMEHIDTOOSCDVER | sed 's|-.*$||g' | cut -d. -f3 )" >> $GITHUB_ENV + - name: set version control + run: 'sed -i "s|Version: .*$|Version: $VOLUMEHIDTOOSCDVER|g" DEBIAN/control' + + - name: set majorVersion cmake + run: 'sed -i "s|^set.*VERSION_MAJOR.*$|set (\${PROJECT_NAME}_VERSION_MAJOR $VOLUMEHIDTOOSCDMAJORVER)|g" CMakeLists.txt' + - name: set minorVersion cmake + run: 'sed -i "s|^set.*VERSION_MINOR.*$|set (\${PROJECT_NAME}_VERSION_MINOR $VOLUMEHIDTOOSCDMINORVER)|g" CMakeLists.txt' + - name: set patchVersion cmake + run: 'sed -i "s|^set.*PATCH_LEVEL.*$|set (\${PROJECT_NAME}_PATCH_LEVEL $VOLUMEHIDTOOSCDPATCHVER)|g" CMakeLists.txt' + + - name: run build + run: './rebuild.sh' + - name: move build + run: 'mv build/volumehidtoosc_1.0.0_amd64.deb $(echo "build/volumehidtoosc_"$VOLUMEHIDTOOSCDVER"_amd64.deb")' + - name: list + run: 'ls -la build/' + - name: list + run: 'cat CMakeLists.txt' + - name: list + run: 'cat DEBIAN/control' + - name: make release + if: ${{ (startsWith(github.ref, 'refs/tags/v')) && (!(contains(github.ref, '-beta'))) }} + uses: softprops/action-gh-release@v1 + with: + files: | + ./build/volumehidtoosc_*.deb + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: make release + if: ${{ (startsWith(github.ref, 'refs/tags/v')) && ((contains(github.ref, '-beta'))) }} + uses: softprops/action-gh-release@v1 + with: + prerelease: true + files: | + ./build/volumehidtoosc_*.deb + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index a5598e7..cde2d3c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,4 @@ install_manifest.txt .cproject .project .settings/ -build/ -.github \ No newline at end of file +build/ \ No newline at end of file diff --git a/README.md b/README.md index 75a73dd..96ed9ad 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,4 @@ working: * config file todo: -* OSC testing -* ci -* service implementation \ No newline at end of file +* documentation \ No newline at end of file