diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..42bf743 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,27 @@ +#**/__pycache__ +#**/.venv +#**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.github +#**/.project +#**/.settings +#**/.toolstarget +**/.vs +**/.vscode +#**/*.*proj.user +#**/*.dbmdl +#**/*.jfm +#**/bin +#**/charts +#**/docker-compose* +#**/compose* +**/Dockerfile* +#**/node_modules +#**/npm-debug.log +build/ +CMakeUserPresets.json +LICENSE.md +README.md diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a314631..f1a5036 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,6 +4,9 @@ on: push: branches: - main + tags: + - "v*.*.*" + workflow_dispatch: # allows manual execution of the workflow @@ -14,34 +17,37 @@ defaults: jobs: build: runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Checkout code uses: actions/checkout@v4 - # - name: Build and package - # uses: docker/build-push-action@v2 - # with: - # context: . - # file: Dockerfile - # push: false - # tags: kdash-build:latest - - name: Build Docker image run: docker build -t kdeck-build . + # NOTE: We use a bind-mount instead of a volume because the runner user + # does not have permission to access a created volume. + - name: Run build in Docker container - #run: docker run -v "$(pwd):/src" kdeck-build - run: docker run -v "build:/src/build" kdeck-build - - # - name: Create tarball - # run: | - # mkdir release - # cp path/to/executable release/ - # cp path/to/LICENSE release/ - # tar -czvf release.tar.gz release/ - - # - name: Upload artifact - # uses: actions/upload-artifact@v2 - # with: - # name: release-artifact - # path: release.tar.gz \ No newline at end of file + run: docker run -v "${{ github.workspace }}/build:/src/build" kdeck-build + + - name: Record hash + run: echo ${{ github.sha }} > release.txt + + - name: Create tarball + run: | + tar -czvf "kdeck-Linux64-${{ github.ref_name }}.tar.gz" \ + --directory="${{ github.workspace }}" \ + release.txt \ + LICENSE.md \ + --directory="${{ github.workspace }}/build/bin/Linux64/Release" \ + kdeck + + - name: Release + uses: softprops/action-gh-release@v2 + with: + prerelease: true + fail_on_unmatched_files: true + files: | + kdeck-Linux64-${{ github.ref_name }}.tar.gz diff --git a/CMakePresets.json b/CMakePresets.json index 0f98e6a..8c04109 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -44,5 +44,25 @@ } } } + ], + "buildPresets": [ + { + "name": "debug", + "displayName": "Debug", + "description": "", + "configurePreset": "debug", + "targets": [ + "kdeck" + ] + }, + { + "name": "release", + "displayName": "Release", + "description": "", + "configurePreset": "release", + "targets": [ + "kdeck" + ] + } ] } \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7a2a319 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM debian:bookworm-slim + +RUN apt-get update && apt-get -y --no-install-recommends --no-install-suggests install \ + build-essential \ + cmake \ + libcurlpp-dev \ + libboost-json1.81-dev \ + libwxgtk3.2-dev \ + && apt-get clean \ + && rm -r /var/lib/apt/lists /var/cache/apt + +WORKDIR /src +COPY . /src + +# NOTE: We have to run the configure step and the build step together +# because /src/build is bind-mounted to the host machine, and that +# needs to occur before the configure step is run or else the +# files are obscured. + +CMD cmake --preset release && cmake --build --preset release