Create release on tags. #13
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| tags: [v*] | |
| permissions: | |
| attestations: write | |
| contents: write | |
| id-token: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-24.04, ubuntu-24.04-arm] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set env | |
| run: | | |
| echo "QUANTLIB_VERSION=$(cat quantlib-version)" >> $GITHUB_ENV | |
| if [ "${{ matrix.os }}" = 'ubuntu-24.04' ]; then | |
| echo "ARCH=amd64" >> $GITHUB_ENV | |
| elif [ "${{ matrix.os }}" = 'ubuntu-24.04-arm' ]; then | |
| echo "ARCH=arm64" >> $GITHUB_ENV | |
| fi | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: false | |
| target: export | |
| platforms: linux/${{ env.ARCH }} | |
| outputs: type=local,dest=./output | |
| - name: Copy artifacts | |
| if: github.event_name == 'push' | |
| run: | | |
| mkdir -p artifacts | |
| cp "output/build/quantlib-${{ env.QUANTLIB_VERSION }}.jar" "artifacts/${{ env.ARCH }}-quantlib-${{ env.QUANTLIB_VERSION }}.jar" | |
| cp "output/build/quantlib-${{ env.QUANTLIB_VERSION }}.pom" "artifacts/${{ env.ARCH }}-quantlib-${{ env.QUANTLIB_VERSION }}.pom" | |
| - name: Attest artifacts | |
| if: github.event_name == 'push' | |
| uses: actions/attest@v4 | |
| with: | |
| subject-path: 'artifacts/*' | |
| - name: Upload artifacts | |
| if: github.event_name == 'push' | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ${{ env.ARCH }}-quantlib-${{ env.QUANTLIB_VERSION }} | |
| path: artifacts/ | |
| if-no-files-found: error | |
| retention-days: 2 | |
| release: | |
| needs: [build] | |
| if: startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push' | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set env | |
| run: | | |
| echo "QUANTLIB_VERSION=$(cat quantlib-version)" >> $GITHUB_ENV | |
| - name: Download amd64 artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: amd64-quantlib-${{ env.QUANTLIB_VERSION }} | |
| path: artifacts/ | |
| - name: Download arm64 artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: arm64-quantlib-${{ env.QUANTLIB_VERSION }} | |
| path: artifacts/ | |
| - name: List artifacts | |
| run: ls -R artifacts | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| draft: true | |
| files: artifacts/* | |
| fail_on_unmatched_files: true |