Testing and Releasing pycmt #6
Workflow file for this run
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: build-and-release | |
| run-name: Testing and Releasing pycmt | |
| on: [push, workflow_dispatch] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| environment: Main | |
| permissions: | |
| packages: write | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| images: | |
| - image: ubuntu | |
| plat: manylinux_2_39_riscv64 | |
| - image: alpine | |
| plat: musllinux_1_2_riscv64 | |
| steps: | |
| - name: Set Envs | |
| run: | | |
| echo "VERSION=0.0.0-dev" >> "$GITHUB_ENV" | |
| cat "$GITHUB_ENV" | |
| if: "!startsWith(github.ref, 'refs/tags/')" | |
| - name: Set Envs | |
| run: | | |
| echo "VERSION=${GITHUB_REF##*/v}" >> "$GITHUB_ENV" | |
| cat "$GITHUB_ENV" | |
| if: "startsWith(github.ref, 'refs/tags/')" | |
| - uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Wheels | |
| run: | | |
| docker build --platform=linux/riscv64 --build-arg PLAT=${{ matrix.images.plat }} -t ${{ matrix.images.image }}-builder -f ${{ matrix.images.image }}.dockerfile . | |
| docker run --rm --platform=linux/riscv64 -e VERSION=${{ env.VERSION }} -v $PWD:/mnt/build -w /mnt/build ${{ matrix.images.image }}-builder /mnt/build/build_wheels.sh | |
| mkdir -p ${{ runner.temp }}/artifacts/${{ matrix.images.image }}/ | |
| find wheelhouse/ -name "*${{ matrix.images.plat }}.whl" -exec cp '{}' ${{ runner.temp }}/artifacts/${{ matrix.images.image }}/. \; | |
| - name: Upload Wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pycmt-${{ matrix.images.plat }} | |
| path: ${{ runner.temp }}/artifacts/${{ matrix.images.image }}/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Set Envs | |
| run: | | |
| echo "VERSION=${GITHUB_REF##*/v}" >> "$GITHUB_ENV" | |
| - name: Download Wheels | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ${{ runner.temp }}/artifacts | |
| pattern: pycmt-* | |
| merge-multiple: true | |
| - name: Upload release assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| prerelease: true | |
| files: artifacts/* | |
| fail_on_unmatched_files: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |