This repository was archived by the owner on Sep 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (79 loc) · 2.99 KB
/
create-release.yaml
File metadata and controls
91 lines (79 loc) · 2.99 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
84
85
86
87
88
89
90
91
name: Create Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Configure GIT
run: |
git config --global user.email "upsolver-cli-bot@github.com"
git config --global user.name "CLI Release Github Bot"
- name: Determine Version
id: release-version
run: |
echo "::set-output name=full::${{ github.ref_name }}"
SIMPLE=$(echo ${{ github.ref_name }} | sed -e s/^v//)
echo "::set-output name=simple::$SIMPLE"
- name: Update Version
run: |
sed -i -e "s/.*__version__.*/__version__ = '${{ steps.release-version.outputs.simple }}'/g" cli/__init__.py
sed -i -e "s/.*version =.*/version = \"${{ steps.release-version.outputs.simple }}\"/g" pyproject.toml
- name: Extract Change Notes
id: extract_changes
run: |
CHANGES=$(sed -n "/^# ${{ steps.release-version.outputs.full }}$/,/^# /p" CHANGELOG.md | sed '$ d')
echo "CHANGES<<EOF" >> $GITHUB_ENV
echo "$CHANGES" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- uses: actions/setup-python@v2
with:
python-version: 3.8.x
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 - --version 1.3.1
poetry install
- name: Build Release Archive
id: build-archive
run: |
poetry build
- name: Generate homebrew formula
run: |
poetry run python scripts/gen-brew-formula.py --cli-archive-url "https://github.com/Upsolver/cli/releases/download/${{ github.ref_name }}/upsolver-cli.tar.gz" --compute-hash-from-file ./dist/upsolver_cli-${{ steps.release-version.outputs.simple }}.tar.gz
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
${{ env.CHANGES }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/upsolver_cli-${{ steps.release-version.outputs.simple }}.tar.gz
asset_name: upsolver-cli.tar.gz
asset_content_type: application/tar+gz
- name: Upload to Pypi
id: upload_pyi
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish
- name: Commit updated homebrew formula & version files
run: |
git commit -am "Release ${{ steps.release-version.outputs.full }}"
git push origin HEAD:master