Skip to content

Commit f09442a

Browse files
committed
feature: create release in Github Actions
1 parent 8a4d086 commit f09442a

1 file changed

Lines changed: 161 additions & 0 deletions

File tree

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
on:
2+
push:
3+
# Sequence of patterns matched against refs/tags
4+
tags:
5+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
6+
7+
name: Release
8+
9+
jobs:
10+
build:
11+
name: Build on ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, macos-latest]
16+
#os: [ubuntu-latest, windows-latest, macos-latest]
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v2
21+
22+
- name: Install stable toolchain
23+
uses: actions-rs/toolchain@v1
24+
with:
25+
profile: minimal
26+
toolchain: nightly
27+
override: true
28+
29+
- name: Setup python 3.6
30+
uses: actions/setup-python@v2
31+
with:
32+
python-version: '3.6'
33+
34+
- name: Setup python 3.7
35+
uses: actions/setup-python@v2
36+
with:
37+
python-version: '3.7'
38+
39+
- name: Setup python 3.8
40+
uses: actions/setup-python@v2
41+
with:
42+
python-version: '3.8'
43+
44+
- name: Install poetry
45+
run: |
46+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
47+
48+
- name: Install dependencies
49+
run: |
50+
env PATH="${PATH}:${HOME}/.poetry/bin" poetry install
51+
52+
- name: Build wheels
53+
run: |
54+
env PATH="${PATH}:${HOME}/.poetry/bin" poetry run maturin build
55+
56+
- name: Copy binary
57+
if: matrix.os == 'ubuntu-latest'
58+
run: |
59+
mkdir -p ./python-streamson-linux/
60+
cp target/wheels/*.whl python-streamson-linux/
61+
tar czf python-streamson-linux.tar.gz python-streamson-linux
62+
mkdir -p ./dist
63+
cp python-streamson-linux.tar.gz dist/
64+
65+
#- name: Copy binary
66+
# if: matrix.os == 'windows-latest'
67+
# run: |
68+
# mkdir -p ./dist
69+
# cp target/wheel/*.whl dist/
70+
71+
- name: Copy binary
72+
if: matrix.os == 'macos-latest'
73+
run: |
74+
mkdir -p ./python-streamson-macos/
75+
cp target/wheels/*.whl python-streamson-macos/
76+
tar czf python-streamson-macos.tar.gz python-streamson-macos
77+
mkdir -p ./dist
78+
cp python-streamson-macos.tar.gz dist/
79+
80+
- name: Upload artifacts
81+
uses: actions/upload-artifact@v1
82+
with:
83+
name: ${{ matrix.os }}
84+
path: ./dist
85+
86+
- name: List
87+
run: ls -al ./dist
88+
89+
release:
90+
name: Create Release
91+
runs-on: ubuntu-latest
92+
needs: ['build']
93+
94+
steps:
95+
- name: Checkout code
96+
uses: actions/checkout@master
97+
98+
- name: Download artifacts ubuntu
99+
uses: actions/download-artifact@v1
100+
with:
101+
name: ubuntu-latest
102+
path: dist
103+
104+
#- name: Download artifacts windows
105+
# uses: actions/download-artifact@v1
106+
# with:
107+
# name: windows-latest
108+
# path: dist
109+
110+
- name: Download artifacts macos
111+
uses: actions/download-artifact@v1
112+
with:
113+
name: macos-latest
114+
path: dist
115+
116+
- name: Get description
117+
run: echo "##[set-output name=tag_description;]$(git tag -l --format='%(contents:body)' ${{ github.ref }})"
118+
id: get_description
119+
120+
- name: Create Release
121+
id: create_release
122+
uses: actions/create-release@v1
123+
env:
124+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125+
with:
126+
tag_name: ${{ github.ref }}
127+
release_name: Release ${{ github.ref }}
128+
body: "${{ steps.get_description.outputs.description }}"
129+
draft: false
130+
prerelease: false
131+
132+
- name: Upload Release Asset ubuntu
133+
uses: actions/upload-release-asset@v1.0.1
134+
env:
135+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
136+
with:
137+
upload_url: ${{ steps.create_release.outputs.upload_url }}
138+
asset_path: dist/python-streamson-linux.tar.gz
139+
asset_name: python-streamson-linux.tar.gz
140+
asset_content_type: application/tar+gzip
141+
142+
143+
#- name: Upload Release Asset windows
144+
# uses: actions/upload-release-asset@v1.0.1
145+
# env:
146+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
147+
# with:
148+
# upload_url: ${{ steps.create_release.outputs.upload_url }}
149+
# asset_path: dist/ucelofka-windows.exe
150+
# asset_name: ucelofka-windows.exe
151+
# asset_content_type: application/bin
152+
153+
- name: Upload Release Asset macos
154+
uses: actions/upload-release-asset@v1.0.1
155+
env:
156+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
157+
with:
158+
upload_url: ${{ steps.create_release.outputs.upload_url }}
159+
asset_path: dist/python-streamson-macos.tar.gz
160+
asset_name: python-streamson-macos.tar.gz
161+
asset_content_type: application/tar+gzip

0 commit comments

Comments
 (0)