chore: added CODEOWNERS #5
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-release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -r test-requirements.txt | |
- name: Test with pytest | |
run: | | |
pytest --cov=hostinger-api | |
release: | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Repo checkout | |
uses: actions/checkout@v4 | |
- name: Bump version and push tag | |
id: bump | |
uses: hennejg/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
release_branches: main | |
- name: Release tag | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.bump.outputs.new_tag }} | |
generateReleaseNotes: true | |
publish: | |
runs-on: ubuntu-latest | |
needs: [release] | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: deps | |
run: python -m pip install -U build | |
- name: build | |
run: python -m build | |
- name: mint API token | |
id: mint-token | |
run: | | |
# retrieve the ambient OIDC token | |
resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ | |
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=pypi") | |
oidc_token=$(jq -r '.value' <<< "${resp}") | |
# exchange the OIDC token for an API token | |
resp=$(curl -X POST https://pypi.org/_/oidc/mint-token -d "{\"token\": \"${oidc_token}\"}") | |
api_token=$(jq -r '.token' <<< "${resp}") | |
# mask the newly minted API token, so that we don't accidentally leak it | |
echo "::add-mask::${api_token}" | |
# see the next step in the workflow for an example of using this step output | |
echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}" | |
- name: publish | |
# gh-action-pypi-publish uses TWINE_PASSWORD automatically | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ steps.mint-token.outputs.api-token }} |