-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: Use GitHub CLI to create GitHub relases (#91)
- Loading branch information
Showing
3 changed files
with
18 additions
and
23 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,36 +2,24 @@ workflows: | |
release: | ||
environment: | ||
vars: | ||
GH_USER: priitlatt | ||
GH_PAT: Encrypted(Z0FBQUFBQmZSUTdyUkh3cW83TVRjMUZ6a3pndFR5SWJnUHR2YlpPYlNLamxaY0xLenluQks5aVdlUVNaRktDN0J5NnE1Yk5KZ2ExaC1OQ1R3SXdxQmdaTTVHQ3d4ZVhYdVNNMEw4dURQcGZacy1mR1BGOXZlRm1YZFUwM2Q1cnptYTkzbEl0eVhOb3g=) | ||
GITHUB_TOKEN: Encrypted(Z0FBQUFBQmdkQXVZLUN0STF4WlBpMEFmc2V5Z2FmMi00bWtUeUFMREJxejNpaW85c3FwcWZsaU51a3BYWlcyc3FPbTlLM2dZeXgzdHY1VnRlX0RVZERmQlhiSlhzQ055YVgwV1R3MXV5N1dobHY5UnhkeHhadWw4cjFsUkNXTUxuTHlxWkduU3JEOHE=) | ||
GOOGLE_CLIENT_SECRET: Encrypted(Z0FBQUFBQmQzbWh3dHNnNU5PV3g4SXpLaXhMbENiVkZKSXk1YVl4YmRPLTZoU29DMmU2NGJNNHpjQWthSTFjTWR4a091Q2FWQlpfMGw5emcxZkM3eUtQSW9QckpwWjl1cWItanJub2FFVWU5VXdTeS12VjNzLTZzamk3cE5PbWhma1J0d2dHaGduQ0JKeHVyVXN0TkkyNlVFOGFVQ3dBakRKMkN2T2Rva3BFUHM1cER5UT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VnlTVFZUQjlKekxRaFRZbnpNRWJHSjZEVXE1WTFyZXZwM0NRQW9lM1lpU0VXelNnX0N5U2p2QnhnUFBuWGVCZjBmTkxTalB5cldOQWNBZ0dTcGRveGpHQ1g0a3c4VGoxX3l3UDBzVjNBcjRkRHFjcTZPelRsN21kNUlSMk02b2NvUT09) | ||
REPOSITORY: codemagic-ci-cd/cli-tools | ||
PYPI_USER: __token__ | ||
PYPI_TOKEN: Encrypted(Z0FBQUFBQmU2TTJqVVYxSy04cm1qOGJzUWhtekNRQ3lGNjdYUTFiUGwybHc2RENLVFo0SDVTVUhyR1JrMkMxckV3QnpFWWxWa0pZVXFsM29aM2djRThUYUlWMlNBMjdWaHQzSm16UjlTSVRocXpWenBhZ20tTjhPU1dZWFNwOHFEWUR3X2pBdC10eGV5cXNvSkpRV2djQncyMWgwdEZzMlhQRC1kcEw5VThTSTcxWUhKQnFrMU5Fc3gtQ29WSDhORHpyMmI1ODh0cFhwMXBhcGRpWDR2b0Q3ZFhBdVFQWlBKSjFxekloUERBV2g2S2piejhubWN5Y3VsOUdhai1xZXlvcWxsbHVSU1dOQ2hmak9jc0pGOXpBN1FYZ01HUzl6U3RTd2dwU1h4NXJBQzY1MmszeXlZS1NoNDhZNEdkMVZlTkZqQVVzRWVoSGRsLXhoRXZYMXd5V1B1U1h1UUdPNzRKcnh6REVxWVBtOVkwbXdJS3QxU1E4PQ==) | ||
name: Generate binary distribution wheel | ||
scripts: | ||
- name: Tag version | ||
script: git tag -a v$(python3 setup.py --version) -m "Release v$(python3 setup.py --version)" | ||
- name: Build wheel | ||
script: python3 setup.py sdist bdist_wheel | ||
- name: Push tag | ||
script: git push "https://$GH_USER:[email protected]/$REPOSITORY" --tags | ||
- name: Prepare release metadata | ||
- name: Draft GitHub release | ||
script: | | ||
TAG_NAME=v$(python3 setup.py --version) | ||
previous_version_line=$(grep -n "^Version " CHANGELOG.md | head -2 | tail -1 | cut -f1 -d:) | ||
head -n "$(($previous_version_line - 1))" CHANGELOG.md | tail +3 > release_notes.txt | ||
python3 -c "import json; json.dump({'tag_name': '$TAG_NAME', 'name': '$TAG_NAME', 'body': open('release_notes.txt').read().strip(), 'draft': True, 'prerelease': True}, open('release_payload.json', 'w'))" | ||
- name: Draft a release | ||
script: | | ||
set -e | ||
curl -u "$GH_USER":"$GH_PAT" --silent --fail -H 'Content-Type: application/json' -X POST --data "@release_payload.json" "https://api.github.com/repos/${REPOSITORY}/releases" > release_response.json | ||
EDIT_URL=$(python3 -c "import json; print(json.load(open('release_response.json')).get('html_url').replace('/tag/', '/edit/'))") | ||
FILE_NAME=$(cd dist && ls *.whl | tail -n1) | ||
UPLOAD_URL=$(python3 -c "import json; print(json.load(open('release_response.json')).get('upload_url').replace('{?name,label}', '?name=$FILE_NAME'))") | ||
curl -u "$GH_USER":"$GH_PAT" --silent --fail -H 'Content-Type: application/x-wheel+zip' -X POST "$UPLOAD_URL" --data-binary "@dist/$FILE_NAME" > /dev/null | ||
echo "Draft release created. Finalize it at $EDIT_URL" | ||
head -n "$(($previous_version_line - 1))" CHANGELOG.md | tail +3 > release_notes.md | ||
gh release create "${TAG_NAME}" \ | ||
--title "${TAG_NAME}" \ | ||
--notes-file release_notes.md \ | ||
--draft \ | ||
dist/codemagic*.whl | ||
- name: Upload wheel | ||
script: | | ||
set -e | ||
|
@@ -48,5 +36,5 @@ workflows: | |
python3 -m pip install --user --upgrade twine | ||
python3 -m twine upload dist/* --username $PYPI_USER --password $PYPI_TOKEN | ||
artifacts: | ||
- dist/codemagic-*.whl | ||
- dist/codemagic-*.tar.gz | ||
- dist/codemagic*.whl | ||
- dist/codemagic*.tar.gz |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
__title__ = 'codemagic-cli-tools' | ||
__description__ = 'CLI tools used in Codemagic builds' | ||
__version__ = '0.5.5' | ||
__version__ = '0.5.6' | ||
__url__ = 'https://github.com/codemagic-ci-cd/cli-tools' | ||
__licence__ = 'GNU General Public License v3.0' |