-
Notifications
You must be signed in to change notification settings - Fork 11
101 lines (80 loc) · 2.66 KB
/
release.yaml
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# GitHub Actions Workflow for Release
name: Release
on:
workflow_call:
inputs:
create_git_tag_and_github_release:
type: boolean
required: true
description: Create Git tag and GitHub release.
outputs:
artifacts_path:
value: ${{ jobs.release.outputs.artifacts_path }}
permissions:
contents: read
env:
PYTHON_VIRTUALENV_ACTIVATE: venv/bin/activate
jobs:
release:
name: Release
runs-on: ubuntu-22.04
permissions:
contents: write
env:
ARTIFACTS_PATH: dist
outputs:
artifacts_path: ${{ env.ARTIFACTS_PATH }}
steps:
- name: Check Out VCS Repository
uses: actions/[email protected]
- name: Set Up Python
id: set_up_python
uses: actions/[email protected]
with:
python-version: "3.10"
- name: Create Python Virtual Environment
run: make python-virtualenv PYTHON_VIRTUALENV_DIR="venv"
- name: Restoring/Saving Cache
uses: actions/[email protected]
with:
path: "venv"
key: py-v1-deps-${{ runner.os }}-${{ steps.set_up_python.outputs.python-version }}-${{ hashFiles('pyproject.toml', 'requirements.txt', 'requirements-dev.txt', 'Makefile', 'make/**.mk') }}
- name: Install Dependencies
run: |
source "$PYTHON_VIRTUALENV_ACTIVATE"
make install-deps-dev
- name: Build
run: |
source "$PYTHON_VIRTUALENV_ACTIVATE"
make clean-build build
- name: Build for Distribution
run: |
source "$PYTHON_VIRTUALENV_ACTIVATE"
make dist
- name: Store Artifacts
uses: actions/[email protected]
with:
name: release
path: ${{ env.ARTIFACTS_PATH }}/
if-no-files-found: error
retention-days: 1
- name: Set Release Configuration
id: set_release_config
run: |
source "$PYTHON_VIRTUALENV_ACTIVATE"
library_version=$(python3 ./setup.py --version)
echo "library_version=${library_version:?}" >> "$GITHUB_OUTPUT"
- name: Create Git Tag and GitHub Release
if: ${{ inputs.create_git_tag_and_github_release }}
run: |
gh release create \
"${VCS_TAG_NAME:?}" \
--target "${TARGET_VCS_REF:?}" \
--generate-notes \
${ASSET_FILES:?}
echo "library_vcs_tag_name=${VCS_TAG_NAME:?}" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VCS_TAG_NAME: v${{ steps.set_release_config.outputs.library_version }}
TARGET_VCS_REF: ${{ github.sha }}
ASSET_FILES: ${{ env.ARTIFACTS_PATH }}/*