-
Notifications
You must be signed in to change notification settings - Fork 4
122 lines (109 loc) · 3.59 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
on:
push:
paths-ignore:
- "docs/**"
- "**.md"
- "examples/**"
branches:
- "main"
- "rc"
jobs:
PRCheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
- run: |
# Download the binary
curl -sLO https://github.com/argoproj/argo-workflows/releases/download/v3.5.4/argo-linux-amd64.gz
# Unzip
gunzip argo-linux-amd64.gz
# Make binary executable
chmod +x argo-linux-amd64
# Move binary to path
mv ./argo-linux-amd64 /usr/local/bin/argo
# Test installation
argo version
- run: python -m pip install poetry
- run: |
python -m poetry install --without docs,binary,perf,tutorial,compare
poetry run tox
Release:
runs-on: ubuntu-latest
needs: PRCheck
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.9
- run: python -m pip install poetry
- run: |
python -m poetry install --only release
- name: Figure version
continue-on-error: true
env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
id: last_tag
run: |
CURRENT=$(python -m poetry run semantic-release -v --noop version --print-last-released)
echo "Current: $CURRENT"
VERSION=$(python -m poetry run semantic-release -v --noop version --print)
echo "new: $VERSION"
# python -m poetry run semantic-release version --tag --push
if [ "$CURRENT" == "$VERSION" ]; then
echo "version=$VERSION" >> $GITHUB_OUTPUT
exit 1
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
exit 0
- name: Apply new tag
if: steps.last_tag.outcome == 'success'
env:
VERSION: ${{ steps.last_tag.outputs.version }}
uses: actions/github-script@v6
with:
script: |
const {VERSION} = process.env
const tag = `refs/tags/${VERSION}`
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: tag,
sha: context.sha
})
- name: Publish to PyPI
if: steps.last_tag.outcome == 'success'
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
LAST_TAG: ${{ steps.last_tag.outputs.version }}
run: |
python scripts/update_version.py $LAST_TAG
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build
- name: "Create release"
if: steps.last_tag.outcome == 'success'
env:
RELEASE_TAG: ${{ steps.last_tag.outputs.version }}
uses: "actions/github-script@v6"
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
try {
const response = await github.rest.repos.createRelease({
draft: false,
generate_release_notes: true,
name: process.env.RELEASE_TAG,
owner: context.repo.owner,
prerelease: false,
repo: context.repo.repo,
tag_name: process.env.RELEASE_TAG,
});
core.exportVariable('RELEASE_ID', response.data.id);
core.exportVariable('RELEASE_UPLOAD_URL', response.data.upload_url);
} catch (error) {
core.setFailed(error.message);
}