add release workflow with per-platform archives #85
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: CI | |
| on: | |
| push: | |
| branches: [master] | |
| tags: ['v*'] | |
| pull_request: | |
| branches: [master] | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| build-linux: | |
| runs-on: ntnu-runners | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install xz | |
| run: sudo apt-get update && sudo apt-get install -y xz-utils | |
| - uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.16.0 | |
| - run: zig build test --summary all | |
| - run: zig build install | |
| - uses: actions/upload-artifact@v3 | |
| with: | |
| name: crdt-server-linux | |
| path: zig-out/bin/crdt-server | |
| if-no-files-found: error | |
| build-windows: | |
| runs-on: ntnu-runners | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install xz and wine | |
| run: sudo apt-get update && sudo apt-get install -y xz-utils wine | |
| - uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.16.0 | |
| - run: zig build test -Dtarget=x86_64-windows-gnu -fwine --summary all | |
| - run: zig build install -Dtarget=x86_64-windows-gnu | |
| - uses: actions/upload-artifact@v3 | |
| with: | |
| name: crdt-server-windows | |
| path: zig-out/bin/crdt-server.exe | |
| if-no-files-found: error | |
| build-macos: | |
| runs-on: ntnu-runners | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install xz | |
| run: sudo apt-get update && sudo apt-get install -y xz-utils | |
| - uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.16.0 | |
| - run: zig build install -Dtarget=x86_64-macos-none | |
| - uses: actions/upload-artifact@v3 | |
| with: | |
| name: crdt-server-macos-x86_64 | |
| path: zig-out/bin/crdt-server | |
| if-no-files-found: error | |
| - run: zig build install -Dtarget=aarch64-macos-none | |
| - uses: actions/upload-artifact@v3 | |
| with: | |
| name: crdt-server-macos-aarch64 | |
| path: zig-out/bin/crdt-server | |
| if-no-files-found: error | |
| build-demo: | |
| runs-on: ntnu-runners | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.16.0 | |
| - run: zig build install-demo | |
| - uses: actions/upload-artifact@v3 | |
| with: | |
| name: crdt-demo | |
| path: zig-out/www/ | |
| if-no-files-found: error | |
| build-docs: | |
| runs-on: ntnu-runners | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install xz | |
| run: sudo apt-get update && sudo apt-get install -y xz-utils | |
| - uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.16.0 | |
| - run: zig build docs | |
| - name: Combine docs | |
| run: | | |
| mkdir -p staging/lib staging/server | |
| cp -r zig-out/docs/lib/* staging/lib/ | |
| cp -r zig-out/docs/server/* staging/server/ | |
| cp .github/pages/index.html staging/ | |
| - uses: actions/upload-pages-artifact@v2 | |
| with: | |
| path: staging | |
| deploy-docs: | |
| if: github.ref == 'refs/heads/master' | |
| needs: build-docs | |
| runs-on: ntnu-runners | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - uses: actions/deploy-pages@v3 | |
| id: deployment | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: [build-linux, build-windows, build-macos, build-demo] | |
| runs-on: ntnu-runners | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v3 | |
| with: | |
| name: crdt-server-linux | |
| path: dist/linux | |
| - uses: actions/download-artifact@v3 | |
| with: | |
| name: crdt-server-windows | |
| path: dist/windows | |
| - uses: actions/download-artifact@v3 | |
| with: | |
| name: crdt-server-macos-x86_64 | |
| path: dist/macos-x86_64 | |
| - uses: actions/download-artifact@v3 | |
| with: | |
| name: crdt-server-macos-aarch64 | |
| path: dist/macos-aarch64 | |
| - uses: actions/download-artifact@v3 | |
| with: | |
| name: crdt-demo | |
| path: dist/demo | |
| - run: mkdir -p package/linux/bin | |
| - run: cp dist/linux/crdt-server package/linux/bin/ | |
| - run: tar czf crdt-${{ github.ref_name }}-linux-x86_64.tar.gz -C package/linux bin/ | |
| - run: mkdir -p package/windows/bin | |
| - run: cp dist/windows/crdt-server.exe package/windows/bin/ | |
| - run: (cd package/windows && zip -r ../../crdt-${{ github.ref_name }}-windows-x86_64.zip bin/) | |
| - run: mkdir -p package/macos-x86_64/bin | |
| - run: cp dist/macos-x86_64/crdt-server package/macos-x86_64/bin/ | |
| - run: tar czf crdt-${{ github.ref_name }}-macos-x86_64.tar.gz -C package/macos-x86_64 bin/ | |
| - run: mkdir -p package/macos-aarch64/bin | |
| - run: cp dist/macos-aarch64/crdt-server package/macos-aarch64/bin/ | |
| - run: tar czf crdt-${{ github.ref_name }}-macos-aarch64.tar.gz -C package/macos-aarch64 bin/ | |
| - run: mkdir -p package/demo/www | |
| - run: cp dist/demo/* package/demo/www/ | |
| - run: tar czf crdt-${{ github.ref_name }}-demo.tar.gz -C package/demo www/ | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| crdt-${{ github.ref_name }}-linux-x86_64.tar.gz | |
| crdt-${{ github.ref_name }}-windows-x86_64.zip | |
| crdt-${{ github.ref_name }}-macos-x86_64.tar.gz | |
| crdt-${{ github.ref_name }}-macos-aarch64.tar.gz | |
| crdt-${{ github.ref_name }}-demo.tar.gz |