-
Notifications
You must be signed in to change notification settings - Fork 1
94 lines (82 loc) · 3.25 KB
/
deploy.yml
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
name: Deploy
on:
push:
branches:
- 'deploy_test'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
env:
SDIST_ARCHIVE: "sdist_archive" # read only
jobs:
build-sdist:
runs-on: ubuntu-latest
container:
image: ghcr.io/crux14/akashi-engine/build-sdist:0.1.11
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
env:
SDIST_TRUEPATH: ""
steps:
- uses: actions/checkout@v2
- name: Validate version
if: "! contains(github.ref, 'deploy_test')"
run: |
TAG_VER=`git describe --tags | sed 's/v//'`
MOD_VER=`python3 setup.py --version`
echo TAG_VER=$TAG_VER, MOD_VER=$MOD_VER
test $TAG_VER = $MOD_VER
- name: Build sdist
run: |
CUSTOM_BOOST_TAR_PATH=${CUSTOM_BOOST_TAR_PATH} python3 setup.py sdist
SDIST_TRUEPATH_TEMP=$(find ./dist -iname '*.tar.gz')
echo "SDIST_TRUEPATH=$SDIST_TRUEPATH_TEMP" >> $GITHUB_ENV
echo "SDIST_TRUEPATH=$SDIST_TRUEPATH_TEMP"
- name: Upload sdist as an artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.SDIST_ARCHIVE }}
path: ${{ env.SDIST_TRUEPATH }}
if-no-files-found: error
test-pipinst-and-upload:
runs-on: ubuntu-latest
needs: build-sdist
container:
image: ghcr.io/crux14/akashi-engine/test-pipinst:0.1.6
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
env:
SDIST_TRUEPATH: ""
SDIST_TRUENAME: ""
steps:
- uses: actions/checkout@v2
- name: Download sdist from artifacts
uses: actions/download-artifact@v2
with:
name: ${{ env.SDIST_ARCHIVE }}
- name: Update envs
run: |
SDIST_TRUEPATH_TEMP=$(find ./ -maxdepth 1 -iname '*.tar.gz')
echo "SDIST_TRUEPATH=$SDIST_TRUEPATH_TEMP" >> $GITHUB_ENV
echo "SDIST_TRUEPATH=$SDIST_TRUEPATH_TEMP"
echo "SDIST_TRUENAME=$(basename $SDIST_TRUEPATH_TEMP)" >> $GITHUB_ENV
echo "SDIST_TRUENAME=$(basename $SDIST_TRUEPATH_TEMP)"
- name: Install and Test pip install
run: |
if [ ! `echo ${{ github.event.head_commit.message }} | grep "\[skip-test-pipinst\]"` ]; then pip3 install ${{ env.SDIST_TRUEPATH }} -v; else echo ::warning::Skipping the pip-install test because a skip flag is detected ;fi
- name: Upload sdist to release
if: "! contains(github.ref, 'deploy_test')"
run: |
TAG_NAME=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g")
echo $TAG_NAME
RELEASE_ID=$(curl -X GET \
-H 'Accept: application/vnd.github.v3+json' \
-H "Authorization: token ${{ secrets.GH_API_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/releases/tags/${TAG_NAME}" | jq -r '.id')
echo $RELEASE_ID
curl -X POST \
--data-binary @${{ env.SDIST_TRUEPATH }} \
-H 'Content-Type: application/x-gzip' \
-H "Authorization: token ${{ secrets.GH_API_TOKEN }}" \
"https://uploads.github.com/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets?name=${{ env.SDIST_TRUENAME }}&label=${{ env.SDIST_TRUENAME }}"