|
1 | | -name: build |
| 1 | +name: ππ Publish to π¬β SciJava and πͺ PyPI |
2 | 2 |
|
3 | 3 | on: |
| 4 | + workflow_dispatch: |
| 5 | + |
4 | 6 | push: |
5 | 7 | branches: |
6 | 8 | - master |
7 | 9 | tags: |
8 | | - - "*-[0-9]+.*" |
| 10 | + - "python-imcflibs-[0-9]+.*" |
9 | 11 | pull_request: |
10 | 12 | branches: |
11 | 13 | - master |
12 | 14 |
|
| 15 | + |
13 | 16 | jobs: |
14 | | - build: |
| 17 | + |
| 18 | + # publish-to-scijava: |
| 19 | + |
| 20 | + # name: π¬β publish via β Maven to SciJava |
| 21 | + |
| 22 | + # runs-on: ubuntu-latest |
| 23 | + |
| 24 | + # steps: |
| 25 | + |
| 26 | + # - uses: actions/checkout@v4 |
| 27 | + # name: π₯ Checkout repo |
| 28 | + |
| 29 | + # - name: β Set up Java |
| 30 | + # uses: actions/setup-java@v3 |
| 31 | + # with: |
| 32 | + # java-version: '8' |
| 33 | + # distribution: 'zulu' |
| 34 | + # cache: 'maven' |
| 35 | + |
| 36 | + # - name: πͺ Set up CI environment |
| 37 | + # run: .github/setup.sh |
| 38 | + |
| 39 | + # - name: π· Build and publish on π¬β SciJava |
| 40 | + # run: .github/build.sh |
| 41 | + # env: |
| 42 | + # GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }} |
| 43 | + # GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |
| 44 | + # MAVEN_USER: ${{ secrets.MAVEN_USER }} |
| 45 | + # MAVEN_PASS: ${{ secrets.MAVEN_PASS }} |
| 46 | + # OSSRH_PASS: ${{ secrets.OSSRH_PASS }} |
| 47 | + # SIGNING_ASC: ${{ secrets.SIGNING_ASC }} |
| 48 | + |
| 49 | + |
| 50 | + build-via-poetry: |
| 51 | + |
| 52 | + name: π· build via π Poetry |
| 53 | + |
| 54 | + runs-on: ubuntu-22.04 |
| 55 | + |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@v4 |
| 58 | + name: π₯ Checkout repo |
| 59 | + |
| 60 | + - name: π΅ Inspect if this is a proper "scijava-scripts" release |
| 61 | + run: scripts/check-if-release.sh |
| 62 | + |
| 63 | + - name: π Set up Python |
| 64 | + uses: actions/setup-python@v5 |
| 65 | + with: |
| 66 | + python-version: "3.10" |
| 67 | + |
| 68 | + - name: π Cache π Poetry install |
| 69 | + uses: actions/cache@v4 |
| 70 | + with: |
| 71 | + path: ~/.local |
| 72 | + key: poetry-2.0.1-0 |
| 73 | + |
| 74 | + # The key configuration value here is `virtualenvs-in-project: true`: this |
| 75 | + # creates the venv as a `.venv` in your testing directory, which allows |
| 76 | + # the next step to easily cache it. |
| 77 | + - name: π©π§ Install π Poetry |
| 78 | + uses: snok/install-poetry@v1 |
| 79 | + with: |
| 80 | + version: 2.0.1 |
| 81 | + virtualenvs-create: true |
| 82 | + virtualenvs-in-project: true |
| 83 | + |
| 84 | + # Cache dependencies (i.e. all the stuff in your `pyproject.toml`). |
| 85 | + - name: π Cache π§Ύ Dependencies |
| 86 | + id: cache-deps |
| 87 | + uses: actions/cache@v4 |
| 88 | + with: |
| 89 | + path: .venv |
| 90 | + key: pydeps-${{ hashFiles('**/poetry.lock') }} |
| 91 | + |
| 92 | + # No Poetry dynamic versioning in this project, we're using the POM instead! |
| 93 | + # - name: π Install Poetry dynamic-versioning π plugin |
| 94 | + # run: poetry self add "poetry-dynamic-versioning[plugin]" |
| 95 | + |
| 96 | + # Install dependencies. `--no-root` means "install all dependencies but |
| 97 | + # not the project itself", which is what you want to avoid caching _your_ |
| 98 | + # code. The `if` statement ensures this only runs on a cache miss. |
| 99 | + - name: π Install π§Ύ Dependencies |
| 100 | + run: scripts/run-poetry.sh install --no-interaction --no-root |
| 101 | + if: steps.cache-deps.outputs.cache-hit != 'true' |
| 102 | + |
| 103 | + - name: π Install π project |
| 104 | + run: scripts/run-poetry.sh install --no-interaction |
| 105 | + |
| 106 | + - name: ππ· Build π§± project |
| 107 | + run: scripts/run-poetry.sh build |
| 108 | + |
| 109 | + - name: π€ Upload build artifacts |
| 110 | + uses: actions/upload-artifact@v4 |
| 111 | + with: |
| 112 | + name: release-dists |
| 113 | + path: dist/ |
| 114 | + |
| 115 | + |
| 116 | + publish-to-pypi: |
| 117 | + |
| 118 | + name: ππ publish to πͺ PyPI |
| 119 | + |
15 | 120 | runs-on: ubuntu-latest |
16 | 121 |
|
| 122 | + needs: |
| 123 | + - release-build |
| 124 | + |
| 125 | + permissions: |
| 126 | + id-token: write |
| 127 | + |
| 128 | + environment: |
| 129 | + name: release |
| 130 | + |
17 | 131 | steps: |
18 | | - - uses: actions/checkout@v2 |
19 | | - - name: Set up Java |
20 | | - uses: actions/setup-java@v3 |
| 132 | + - name: π₯ Retrieve release π¦ distributions |
| 133 | + uses: actions/download-artifact@v4 |
21 | 134 | with: |
22 | | - java-version: '8' |
23 | | - distribution: 'zulu' |
24 | | - cache: 'maven' |
25 | | - - name: Set up CI environment |
26 | | - run: .github/setup.sh |
27 | | - - name: Execute the build |
28 | | - run: .github/build.sh |
29 | | - env: |
30 | | - GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }} |
31 | | - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |
32 | | - MAVEN_USER: ${{ secrets.MAVEN_USER }} |
33 | | - MAVEN_PASS: ${{ secrets.MAVEN_PASS }} |
34 | | - OSSRH_PASS: ${{ secrets.OSSRH_PASS }} |
35 | | - SIGNING_ASC: ${{ secrets.SIGNING_ASC }} |
| 135 | + name: release-dists |
| 136 | + path: dist/ |
| 137 | + |
| 138 | + - name: π₯ Publish release distributions to πͺ PyPI |
| 139 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 140 | + with: |
| 141 | + packages-dir: dist/ |
| 142 | + |
| 143 | + |
| 144 | + trigger-foreign-workflows: |
| 145 | + |
| 146 | + name: π Dispatch foreign workflows |
| 147 | + |
| 148 | + strategy: |
| 149 | + matrix: |
| 150 | + repo: ['imcf/imcf.github.io'] |
| 151 | + |
| 152 | + runs-on: ubuntu-latest |
| 153 | + |
| 154 | + steps: |
| 155 | + - name: πΉ Fire event on `${{ matrix.repo }}` |
| 156 | + run: | |
| 157 | + curl -L \ |
| 158 | + -X POST \ |
| 159 | + -H "Accept: application/vnd.github+json" \ |
| 160 | + -H "Authorization: Bearer ${{ secrets.DISPATCH_DEPLOY_PAGES }}" \ |
| 161 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 162 | + https://api.github.com/repos/${{ matrix.repo }}/dispatches \ |
| 163 | + -d '{"event_type":"dispatch-event"}' |
0 commit comments