Release #1
This file contains 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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version_to_publish: | |
description: "Version to be release" | |
required: false | |
jobs: | |
TestMainline: | |
name: Test Mainline | |
uses: ./.github/workflows/reuse_python_build.yml | |
with: | |
branch: mainline | |
secrets: inherit | |
Merge: | |
needs: TestMainline | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: release | |
fetch-depth: 0 | |
token: ${{ secrets.CI_TOKEN }} | |
- name: Set Git config | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "client-software-ci" | |
- name: Update Release | |
run: git merge --ff-only origin/mainline -v | |
- name: Push new release | |
if: ${{ inputs.version_to_publish}} | |
run: | | |
git tag -a ${{ inputs.version_to_publish }} -m "Release ${{ inputs.version_to_publish }}" | |
git push origin release ${{ inputs.version_to_publish }} | |
- name: Push post release | |
if: ${{ !inputs.version_to_publish}} | |
run: git push origin release | |
TestRelease: | |
needs: Merge | |
name: Test Release | |
uses: ./.github/workflows/reuse_python_build.yml | |
with: | |
branch: release | |
secrets: inherit | |
PublishMirror: | |
needs: TestRelease | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
CODEARTIFACT_REGION: "us-west-2" | |
CODEARTIFACT_DOMAIN: ${{ secrets.CODEARTIFACT_DOMAIN }} | |
CODEARTIFACT_ACCOUNT_ID: ${{ secrets.CODEARTIFACT_ACCOUNT_ID }} | |
CODEARTIFACT_REPOSITORY: ${{ secrets.CODEARTIFACT_REPOSITORY }} | |
CUSTOMER_REPOSITORY: ${{ secrets.CUSTOMER_REPOSITORY }} | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v3 | |
with: | |
ref: release | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
role-to-assume: ${{ secrets.AWS_CODEARTIFACT_ROLE }} | |
aws-region: us-west-2 | |
- name: Install dependencies | |
run: | | |
CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token --domain ${{ secrets.CODEARTIFACT_DOMAIN }} --domain-owner ${{ secrets.CODEARTIFACT_ACCOUNT_ID }} --query authorizationToken --output text --region us-west-2) | |
echo "::add-mask::$CODEARTIFACT_AUTH_TOKEN" | |
echo CODEARTIFACT_AUTH_TOKEN=$CODEARTIFACT_AUTH_TOKEN >> $GITHUB_ENV | |
pip install --upgrade hatch | |
pip install --upgrade twine | |
- name: Run Build | |
run: hatch build | |
- name: Publish | |
run: | | |
export TWINE_USERNAME=aws | |
export TWINE_PASSWORD=`aws codeartifact get-authorization-token --domain ${{ secrets.CODEARTIFACT_DOMAIN }} --domain-owner ${{ secrets.CODEARTIFACT_ACCOUNT_ID }} --query authorizationToken --output text` | |
export TWINE_REPOSITORY_URL=`aws codeartifact get-repository-endpoint --domain ${{ secrets.CODEARTIFACT_DOMAIN }} --domain-owner ${{ secrets.CODEARTIFACT_ACCOUNT_ID }} --repository ${{ secrets.CODEARTIFACT_REPOSITORY }} --format pypi --query repositoryEndpoint --output text` | |
twine upload dist/* | |
- name: Publish to Customer CodeArtifact | |
run: | | |
export TWINE_USERNAME=aws | |
export TWINE_PASSWORD=`aws codeartifact get-authorization-token --domain ${{ secrets.CODEARTIFACT_DOMAIN }} --domain-owner ${{ secrets.CODEARTIFACT_ACCOUNT_ID }} --query authorizationToken --output text` | |
export TWINE_REPOSITORY_URL=`aws codeartifact get-repository-endpoint --domain ${{ secrets.CODEARTIFACT_DOMAIN }} --domain-owner ${{ secrets.CODEARTIFACT_ACCOUNT_ID }} --repository ${{ secrets.CUSTOMER_REPOSITORY }} --format pypi --query repositoryEndpoint --output text` | |
twine upload dist/* |