| name: On Release | |
| # By default, a workflow only has read permissions. | |
| # Add the needed permission to write release assets | |
| permissions: | |
| contents: write | |
| on: | |
| release: | |
| types: | |
| - published | |
| jobs: | |
| build: | |
| name: Add Release Assets | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Amalgamate fast_float.h | |
| run: | | |
| mkdir build | |
| mkdir build/fast_float | |
| python3 ./script/amalgamate.py > build/fast_float/fast_float.h | |
| - name: Test Amalgamation | |
| run: | | |
| cp tests/string_test.cpp build/ | |
| cd build | |
| g++ string_test.cpp | |
| ./a.out | |
| - name: Upload Release Asset | |
| # --clobber replaces an asset that was already attached by hand, which | |
| # would otherwise make the upload fail. | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release upload "${{ github.event.release.tag_name }}" \ | |
| build/fast_float/fast_float.h --clobber |