Skip to content

release: v0.14.0b1 (#679) #40

release: v0.14.0b1 (#679)

release: v0.14.0b1 (#679) #40

Workflow file for this run

name: CD
on:
workflow_dispatch:
push:
tags:
- v*
permissions:
contents: write
jobs:
functional-latest:
uses: ./.github/workflows/functional-tests.yml
with:
worker_version: latest
api_version: latest
build:
name: Build
runs-on: ubuntu-latest
needs: functional-latest
outputs:
release_id: ${{ steps.gh-release.outputs.id }}
steps:
- name: Checkout release tag
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Set up Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f
with:
python-version: '3.x'
- name: Install build dependency
run: python3 -m pip install --upgrade pip build twine
- name: Build binary wheel and source tarball
run: python3 -m build --sdist --wheel --outdir dist/ .
- name: Check distribution's long description rendering on PyPI
run: twine check dist/*
- id: gh-release
name: Publish GitHub release candidate
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191
with:
name: ${{ github.ref_name }}-rc
tag_name: ${{ github.ref }}
body: "Release waiting for review..."
files: dist/*
- name: Store build artifacts
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a
# NOTE: The GitHub release page contains the release artifacts too, but using
# GitHub upload/download actions seems robuster: there is no need to compute
# download URLs and tampering with artifacts between jobs is more limited.
with:
name: build-artifacts
path: dist
release:
name: Release
runs-on: ubuntu-latest
needs: build
environment: release
permissions:
contents: write # to update GitHub releases
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Fetch build artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
with:
name: build-artifacts
path: dist
- name: Finalize GitHub release
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
script: |
await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: '${{ needs.build.outputs.release_id }}',
name: '${{ github.ref_name }}',
})
- name: Publish distribution 📦 to Test PyPI
env:
name: testpypi
url: https://pypi.org/p/repository-service-tuf
if: github.repository == 'repository-service-tuf/repository-service-tuf-cli'
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish binary wheel and source tarball 📦 on PyPI
env:
name: pypi
url: https://pypi.org/p/repository-service-tuf
# Only attempt PyPI upload in upstream repository
if: github.repository == 'repository-service-tuf/repository-service-tuf-cli'
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0