|
| 1 | +on: |
| 2 | + push: |
| 3 | + tags: |
| 4 | + - "v*" |
| 5 | + # should we prevent main branch build? |
| 6 | + # warning about tag variable when not a tag push, |
| 7 | + # devsim_win64_refs/heads/r2.9.2 |
| 8 | + #branches: |
| 9 | + # - "r2.9.2" |
| 10 | + |
| 11 | +#TODO: handle common code in build steps |
| 12 | + |
| 13 | +jobs: |
| 14 | + create_release_tag: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Checkout repository |
| 18 | + uses: actions/checkout@v5 |
| 19 | + with: |
| 20 | + submodules: false |
| 21 | + - name: Create Release |
| 22 | + env: |
| 23 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use the default GITHUB_TOKEN |
| 24 | + run: | |
| 25 | + TAG=${GITHUB_REF#refs/tags/} # Extract the tag name from the ref |
| 26 | + gh release create "$TAG" \ |
| 27 | + --prerelease \ |
| 28 | + --title "Release $TAG" \ |
| 29 | + --notes "Automated release for $TAG." \ |
| 30 | + --generate-notes # Automatically generate release notes based on commits |
| 31 | + echo "Release $TAG created successfully." |
| 32 | + build_windows: |
| 33 | + if: true |
| 34 | + name: Build on Windows |
| 35 | + runs-on: windows-2025 |
| 36 | + needs: create_release_tag |
| 37 | + steps: |
| 38 | + - name: set git crlf |
| 39 | + run: git config --global core.autocrlf input |
| 40 | + - name: Set tags and variables |
| 41 | + shell: bash |
| 42 | + run: | |
| 43 | + TAG=${GITHUB_REF#refs/tags/} |
| 44 | + echo "TAG=$TAG" >> $GITHUB_ENV |
| 45 | + echo "README_BASE_URL=https://github.com/devsim/symdiff/blob/${TAG}" >> $GITHUB_ENV |
| 46 | + echo "PLATFORM=x64" >> $GITHUB_ENV |
| 47 | + echo "CONDA_BIN=${CONDA}\\condabin\\conda.bat" >> $GITHUB_ENV |
| 48 | + - name: Checkout repository |
| 49 | + uses: actions/checkout@v5 |
| 50 | + with: |
| 51 | + submodules: false |
| 52 | + - name: compilation |
| 53 | + shell: cmd |
| 54 | + run: | |
| 55 | + scripts\build_appveyor.bat %PLATFORM% %CONDA_BIN% |
| 56 | + - name: Upload Release Asset ${{ runner.os }} ${{ runner.arch }} |
| 57 | + shell: bash |
| 58 | + env: |
| 59 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 60 | + run: | |
| 61 | + gh release upload "$TAG" *.whl |
| 62 | + echo "Asset uploaded to release $TAG." |
| 63 | + build_linux: |
| 64 | + if: true |
| 65 | + name: Build on Linux or macOS |
| 66 | + needs: create_release_tag |
| 67 | + strategy: |
| 68 | + matrix: |
| 69 | + os: [ubuntu-24.04, ubuntu-24.04-arm, macos-14] |
| 70 | + runs-on: ${{matrix.os}} |
| 71 | + steps: |
| 72 | + - name: Checkout repository |
| 73 | + uses: actions/checkout@v5 |
| 74 | + with: |
| 75 | + submodules: false |
| 76 | + - name: Set tag |
| 77 | + run: | |
| 78 | + TAG=${GITHUB_REF#refs/tags/} |
| 79 | + echo "TAG=$TAG" >> $GITHUB_ENV |
| 80 | + echo "README_BASE_URL=https://github.com/devsim/symdiff/blob/${TAG}" >> $GITHUB_ENV |
| 81 | + - name: build ${{ runner.os }} ${{ runner.arch }} |
| 82 | + run: | |
| 83 | + if [ "$RUNNER_OS" == "Linux" ]; then |
| 84 | + bash ./scripts/build_docker_manylinux_2_28.sh ${TAG}; |
| 85 | + elif [ "$RUNNER_OS" == "macOS" ]; then |
| 86 | + bash ./scripts/build_macos.sh ${TAG}; |
| 87 | + else |
| 88 | + echo "$RUNNER_OS not supported" |
| 89 | + exit 1 |
| 90 | + fi |
| 91 | + - name: Upload Release Asset ${{ runner.os }} ${{ runner.arch }} |
| 92 | + env: |
| 93 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 94 | + run: | |
| 95 | + gh release upload "$TAG" *.whl |
| 96 | + echo "Asset uploaded to release $TAG." |
0 commit comments