|
| 1 | +name: publish |
| 2 | +concurrency: |
| 3 | + group: ${{ github.workflow }} |
| 4 | + cancel-in-progress: true |
| 5 | +on: # yamllint disable-line rule:truthy |
| 6 | + release: |
| 7 | + types: [published] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + if: ${{ github.repository == 'Dandelion-Science/python-evdev' }} |
| 12 | + name: build py${{ matrix.python-version }} |
| 13 | + runs-on: codebuild-dandelion-linux-amd64-${{ github.run_id }}-${{ github.run_attempt }} |
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + python-version: ["3.13", "3.13t", "3.14", "3.14t"] |
| 18 | + timeout-minutes: 15 |
| 19 | + permissions: |
| 20 | + id-token: write |
| 21 | + contents: read |
| 22 | + steps: |
| 23 | + - uses: aws-actions/configure-aws-credentials@v6 |
| 24 | + with: |
| 25 | + aws-region: ${{ vars.AWS_REGION }} |
| 26 | + role-to-assume: ${{ vars.ARN_IAM_ROLE_GHA_CORE }} |
| 27 | + - uses: actions/checkout@v7 |
| 28 | + with: |
| 29 | + fetch-depth: 0 |
| 30 | + - uses: Dandelion-Science/github-actions/setup-uv@main |
| 31 | + with: |
| 32 | + python-version: ${{ matrix.python-version }} |
| 33 | + - run: uv build --wheel |
| 34 | + - uses: actions/upload-artifact@v4 |
| 35 | + with: |
| 36 | + name: dist-${{ matrix.python-version }} |
| 37 | + path: dist/ |
| 38 | + |
| 39 | + build-sdist: |
| 40 | + if: ${{ github.repository == 'Dandelion-Science/python-evdev' }} |
| 41 | + runs-on: codebuild-dandelion-linux-arm64-${{ github.run_id }}-${{ github.run_attempt }} |
| 42 | + timeout-minutes: 15 |
| 43 | + permissions: |
| 44 | + id-token: write |
| 45 | + contents: read |
| 46 | + steps: |
| 47 | + - uses: aws-actions/configure-aws-credentials@v6 |
| 48 | + with: |
| 49 | + aws-region: ${{ vars.AWS_REGION }} |
| 50 | + role-to-assume: ${{ vars.ARN_IAM_ROLE_GHA_CORE }} |
| 51 | + - uses: actions/checkout@v7 |
| 52 | + with: |
| 53 | + fetch-depth: 0 |
| 54 | + - uses: Dandelion-Science/github-actions/setup-uv@main |
| 55 | + - run: uv build --sdist |
| 56 | + - uses: actions/upload-artifact@v4 |
| 57 | + with: |
| 58 | + name: dist-sdist |
| 59 | + path: dist/ |
| 60 | + |
| 61 | + publish: |
| 62 | + if: ${{ github.repository == 'Dandelion-Science/python-evdev' }} |
| 63 | + needs: [build, build-sdist] |
| 64 | + runs-on: codebuild-dandelion-linux-arm64-${{ github.run_id }}-${{ github.run_attempt }} |
| 65 | + timeout-minutes: 15 |
| 66 | + permissions: |
| 67 | + id-token: write |
| 68 | + contents: write |
| 69 | + steps: |
| 70 | + - uses: aws-actions/configure-aws-credentials@v6 |
| 71 | + with: |
| 72 | + aws-region: ${{ vars.AWS_REGION }} |
| 73 | + role-to-assume: ${{ vars.ARN_IAM_ROLE_GHA_CORE }} |
| 74 | + - uses: actions/download-artifact@v4 |
| 75 | + with: |
| 76 | + path: dist |
| 77 | + merge-multiple: true |
| 78 | + - uses: softprops/action-gh-release@v3 |
| 79 | + with: |
| 80 | + files: dist/* |
| 81 | + tag_name: ${{ github.event.release.tag_name }} |
| 82 | + - name: Get CodeArtifact token |
| 83 | + run: | |
| 84 | + AWS_CODEARTIFACT_TOKEN=$(aws codeartifact get-authorization-token \ |
| 85 | + --domain ${{ vars.CODEARTIFACT_DOMAIN }} \ |
| 86 | + --domain-owner ${{ vars.CODEARTIFACT_DOMAIN_OWNER }} \ |
| 87 | + --query authorizationToken \ |
| 88 | + --output text) |
| 89 | + echo "AWS_CODEARTIFACT_TOKEN=$AWS_CODEARTIFACT_TOKEN" >> $GITHUB_ENV |
| 90 | + - uses: Dandelion-Science/github-actions/setup-uv@main |
| 91 | + - run: uv publish |
| 92 | + env: |
| 93 | + UV_PUBLISH_USERNAME: aws |
| 94 | + UV_PUBLISH_PASSWORD: ${{ env.AWS_CODEARTIFACT_TOKEN }} |
| 95 | + UV_PUBLISH_URL: ${{ vars.CODEARTIFACT_DANDELION_PYPI_REPOSITORY_URL }} |
0 commit comments