-
Notifications
You must be signed in to change notification settings - Fork 25
71 lines (55 loc) · 1.77 KB
/
publish-official-package.yaml
File metadata and controls
71 lines (55 loc) · 1.77 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
name: Publish Official Package
on:
workflow_dispatch:
inputs:
ref_name:
description: 'Git reference (branch or tag) to build and publish'
required: true
type: string
jobs:
build-and-upload:
runs-on: ubuntu-22.04
steps:
- name: "Checkout the specified ref"
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref_name }}
fetch-depth: 0 # Import all commit history and tag
- name: "Build package"
run: |
./ccex build
- name: "Check requested version (ref_name)"
run: |
INPUT_REF="${{ inputs.ref_name }}"
TAG_VERSION="${INPUT_REF#v}" # Strip leading 'v' from ref_name
VERSION="$(versioningit)"
CLEAN_VERSION="$(echo "$VERSION" | cut -d'.' -f1-3)"
echo "$CLEAN_VERSION"
echo "VERSION from prepared package: $CLEAN_VERSION"
echo "VERSION from ref_name: $TAG_VERSION"
if [ "$CLEAN_VERSION" != "$TAG_VERSION" ]; then
echo "::error::VERSION($CLEAN_VERSION) of current package does not match your requested ref_name ($INPUT_REF)"
exit 1
fi
- name: "Upload artifact"
uses: actions/upload-artifact@v4
with:
name: "wheel"
path: "./dist/"
publish-to-pypi:
needs:
- build-and-upload
runs-on: ubuntu-22.04
environment:
name: pypi
url: https://pypi.org/p/TICO
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: "Download all the dists"
uses: actions/download-artifact@v4
with:
name: "wheel"
path: "./dist/"
- name: "Publish distribution to PyPI"
uses: pypa/gh-action-pypi-publish@release/v1