This repository was archived by the owner on May 22, 2026. It is now read-only.
forked from danimaribeiro/PyTrustNFe
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (74 loc) · 2.74 KB
/
Copy pathpublish-python.yaml
File metadata and controls
83 lines (74 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Publish pytrustnfe3 to CodeArtifact
on:
workflow_call:
inputs:
version:
description: "Version (CalVer): YYYYMMDD.X — (e.g. 20260515.1)."
required: true
type: string
isSnapshot:
description: "If true (xproto-style): FINAL_VERSION=<base>-dev+<git short sha> with base CalVer."
required: true
type: boolean
default: false
workflow_dispatch:
inputs:
version:
description: "CalVer: YYYYMMDD.X (e.g. 20260515.1; avoid leading zeros after the dot)"
required: true
type: string
isSnapshot:
description: "Snapshot build: append -dev+<git short sha> to the CalVer base (same as xproto)."
required: true
type: boolean
default: false
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_CODE_ARTIFACT }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_CODE_ARTIFACT }}
aws-region: ${{ secrets.AWS_REGION_CODE_ARTIFACT }}
- name: CodeArtifact authorization token
run: |
CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token \
--domain loggi \
--domain-owner ${{ secrets.AWS_DOMAIN_OWNER_CODE_ARTIFACT }} \
--region ${{ secrets.AWS_REGION_CODE_ARTIFACT }} \
--query authorizationToken --output text)
echo "::add-mask::$CODEARTIFACT_AUTH_TOKEN"
echo "CODEARTIFACT_AUTH_TOKEN=$CODEARTIFACT_AUTH_TOKEN" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.5
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install dependencies
run: poetry install --with dev --no-interaction --no-root
- name: Compose version string
run: |
set -euo pipefail
if [ "${{ inputs.isSnapshot }}" = "true" ]; then
echo "FINAL_VERSION=${BASE}-dev+$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
else
echo "FINAL_VERSION=${BASE}" >> "$GITHUB_ENV"
fi
env:
BASE: ${{ inputs.version }}
- name: Publish to CodeArtifact
env:
POETRY_HTTP_BASIC_LOGGI_USERNAME: aws
POETRY_HTTP_BASIC_LOGGI_PASSWORD: ${{ env.CODEARTIFACT_AUTH_TOKEN }}
FINAL_VERSION: ${{ env.FINAL_VERSION }}
run: |
poetry version "$FINAL_VERSION"
poetry publish --build --repository loggi