forked from twosixlabs/armory
-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (119 loc) Β· 4.2 KB
/
release.yml
File metadata and controls
143 lines (119 loc) Β· 4.2 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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
---
name: π Armory Release Workflow
on:
repository_dispatch:
types: build-and-release
workflow_dispatch:
inputs:
dry_run:
type: boolean
description: Execute a dry-run(no uploads) of the workflow
required: true
default: true
# Limit workflow to one job per branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
RELEASE_DRY_RUN: "${{ github.event_name != 'repository_dispatch' && github.event.inputs.dry_run }}"
jobs:
release-wheel:
name: π Build release wheel
runs-on: ubuntu-latest
steps:
- name: π Setup Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: π© Checkout Armory w/ full depth(for tags and SCM)
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.client_payload.branch }}
- name: π¨ Build wheel
run: |
pip install pip==22.2.2
# Ensure `hatch` is installed
pip install hatch
hatch build --clean --target wheel
# TODO: Add pre-release steps; e.g. publish to TestPyPI
- name: π¦ Release wheel
if: ${{ env.RELEASE_DRY_RUN == 'false' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
# user: __token__
password: ${{ secrets.pypi_token }}
packages_dir: dist
verbose: true
- name: π Archiving Artifacts
uses: actions/upload-artifact@v3
if: ${{ !failure() }}
continue-on-error: true
with:
name: armory-release-artifacts
retention-days: 1
path: |
dist/*.whl
release-docker:
name: Build and Release Docker Images
needs: [release-wheel]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- image: armory
- image: pytorch-deepspeech
steps:
- name: π Setup Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: π© Checkout Armory w/ full depth(for tags and SCM)
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.client_payload.branch }}
- name: π Setup Build Environment
run: |
pip install pip>=22.2.2
pip install .
armory configure --use-defaults
ARMORY_VERSION=`python -m armory --version 2> /dev/null | sed -r 's/\+/\./g'`
echo "ARMORY_VERSION=${ARMORY_VERSION}" >> $GITHUB_ENV
- name: βοΈ Login to DockerHub
if: ${{ env.RELEASE_DRY_RUN == 'false' }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# run: |
# docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
# TODO: Build Base Image
- name: π¨ Build Release Image
run: |
echo "Armory Version: ${{ env.ARMORY_VERSION }}"
echo "Building Armory ${{ matrix.image }} Image"
python docker/build.py --framework ${{ matrix.image }} >> /tmp/build.log
- name: π Archiving Artifacts
uses: actions/upload-artifact@v3
if: ${{ !failure() }}
continue-on-error: true
with:
name: armory-release-artifacts
retention-days: 1
path: |
/tmp/build.log
- name: π¦ Push Release Images
if: ${{ env.RELEASE_DRY_RUN == 'false' }}
run: |
ARMORY_VERSION="${{ env.ARMORY_VERSION }}"
echo "Pushing ${{ matrix.image }}:${ARMORY_VERSION}"
docker push twosixarmory/${{ matrix.image }}:${ARMORY_VERSION}
echo "Tagging ${{ matrix.image }}:${ARMORY_VERSION} as ${{ matrix.image }}:latest"
docker tag twosixarmory/${{ matrix.image }}:${ARMORY_VERSION} twosixarmory/${{ matrix.image }}:latest
echo "Pushing ${{ matrix.image }}:latest"
docker push twosixarmory/${{ matrix.image }}:latest
# Workflow Test:
# act --detect-event -j release-wheel
# act workflow_dispatch -j release-docker --eventpath .github/workflows/tests/release-dry-run.json