Merge pull request #131 from chrishayen/feature/set-collection #48
This file contains hidden or 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: Auto Release | |
| on: | |
| push: | |
| branches: [master] | |
| concurrency: | |
| group: auto-release | |
| cancel-in-progress: false | |
| jobs: | |
| build-test-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| ccache \ | |
| libfmt-dev \ | |
| libboost-context-dev \ | |
| libboost-fiber-dev \ | |
| libssl-dev | |
| - name: Install tomlplusplus | |
| run: | | |
| git clone --depth 1 https://github.com/marzer/tomlplusplus.git /tmp/tomlplusplus | |
| cd /tmp/tomlplusplus | |
| mkdir build && cd build | |
| cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local | |
| sudo make install | |
| - name: Build | |
| run: make build | |
| - name: Run tests | |
| run: make test | |
| - name: Check and bump version | |
| id: version | |
| run: | | |
| CURRENT_VERSION=$(cat VERSION) | |
| CURRENT_TAG="v${CURRENT_VERSION}" | |
| if git rev-parse "$CURRENT_TAG" >/dev/null 2>&1; then | |
| echo "Tag $CURRENT_TAG already exists, bumping minor version" | |
| IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION" | |
| NEW_MINOR=$((MINOR + 1)) | |
| NEW_VERSION="${MAJOR}.${NEW_MINOR}.0" | |
| echo "$NEW_VERSION" > VERSION | |
| echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
| echo "version_bumped=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "Tag $CURRENT_TAG does not exist, using current version" | |
| echo "new_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT | |
| echo "version_bumped=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit version bump | |
| if: steps.version.outputs.version_bumped == 'true' | |
| run: | | |
| git config user.name "Chris Hayen" | |
| git config user.email "chris@shotgun.dev" | |
| git add VERSION | |
| git commit -m "Bump version to ${{ steps.version.outputs.new_version }}" | |
| git push | |
| - name: Create and push tag | |
| run: | | |
| NEW_TAG="v${{ steps.version.outputs.new_version }}" | |
| git config user.name "Chris Hayen" | |
| git config user.email "chris@shotgun.dev" | |
| git tag -a "$NEW_TAG" -m "Release $NEW_TAG" | |
| git push origin "$NEW_TAG" | |
| - name: Package release artifacts | |
| run: | | |
| mkdir -p release/lib release/include | |
| cp build/bishop release/ | |
| cp build/lib/*.a release/lib/ | |
| cp -r build/include/* release/include/ | |
| cd release && tar -czvf ../bishop-linux-x64-v${{ steps.version.outputs.new_version }}.tar.gz . | |
| - name: Build .deb package | |
| run: | | |
| VERSION="${{ steps.version.outputs.new_version }}" | |
| PKG_DIR="bishop_${VERSION}_amd64" | |
| mkdir -p "${PKG_DIR}/DEBIAN" | |
| mkdir -p "${PKG_DIR}/usr/local/bin" | |
| mkdir -p "${PKG_DIR}/usr/local/lib/bishop" | |
| mkdir -p "${PKG_DIR}/usr/local/include/bishop/fiber_asio" | |
| cat > "${PKG_DIR}/DEBIAN/control" << EOF | |
| Package: bishop | |
| Version: ${VERSION} | |
| Section: devel | |
| Priority: optional | |
| Architecture: amd64 | |
| Maintainer: Chris Hayen <chris@shotgun.dev> | |
| Description: Bishop programming language compiler | |
| Bishop is a modern programming language that transpiles to C++. | |
| It combines the power of C++ with an elegant, Python-inspired | |
| syntax designed for readability and ease of use. | |
| EOF | |
| sed -i 's/^ //' "${PKG_DIR}/DEBIAN/control" | |
| cp build/bishop "${PKG_DIR}/usr/local/bin/" | |
| cp build/lib/libbishop_std_runtime.a "${PKG_DIR}/usr/local/lib/bishop/" | |
| cp build/lib/libbishop_http_runtime.a "${PKG_DIR}/usr/local/lib/bishop/" | |
| cp build/lib/libllhttp.a "${PKG_DIR}/usr/local/lib/bishop/" | |
| cp build/include/bishop/std.hpp "${PKG_DIR}/usr/local/include/bishop/" | |
| cp build/include/bishop/std.hpp.gch "${PKG_DIR}/usr/local/include/bishop/" | |
| cp build/include/bishop/error.hpp "${PKG_DIR}/usr/local/include/bishop/" | |
| cp build/include/bishop/http.hpp "${PKG_DIR}/usr/local/include/bishop/" | |
| cp build/include/bishop/http.hpp.gch "${PKG_DIR}/usr/local/include/bishop/" | |
| cp build/include/bishop/fs.hpp "${PKG_DIR}/usr/local/include/bishop/" | |
| cp build/include/bishop/crypto.hpp "${PKG_DIR}/usr/local/include/bishop/" | |
| cp build/include/bishop/net.hpp "${PKG_DIR}/usr/local/include/bishop/" | |
| cp build/include/bishop/net.hpp.gch "${PKG_DIR}/usr/local/include/bishop/" | |
| cp build/include/bishop/process.hpp "${PKG_DIR}/usr/local/include/bishop/" | |
| cp build/include/bishop/fiber_asio/*.hpp "${PKG_DIR}/usr/local/include/bishop/fiber_asio/" | |
| cp build/include/llhttp.h "${PKG_DIR}/usr/local/include/" | |
| dpkg-deb --build --root-owner-group "${PKG_DIR}" | |
| mv "${PKG_DIR}.deb" "bishop-linux-x64-v${{ steps.version.outputs.new_version }}.deb" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.version.outputs.new_version }} | |
| files: | | |
| bishop-linux-x64-v${{ steps.version.outputs.new_version }}.tar.gz | |
| bishop-linux-x64-v${{ steps.version.outputs.new_version }}.deb | |
| generate_release_notes: true |