forked from internap/fake-switches
-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (64 loc) · 2.12 KB
/
release.yaml
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
---
name: release
on:
release:
types: [released, prereleased]
jobs:
build-and-publish:
permissions:
contents: read
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python_version: ["3.5"]
tox_env: ['py35']
steps:
- uses: actions/checkout@v3
- name: "Set up Python ${{ matrix.python_version }}"
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: python -m pip install --upgrade pip
- name: Install building dependencies
run: pip install wheel tox
- name: Build venv
run: |
tox -e ${{ matrix.tox_env }} --notest
- name: Run
run: |
rm -rf dist || true
.tox/${{ matrix.tox_env }}/bin/python setup.py sdist bdist_wheel
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'release'
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
docker-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: internap/fake-switches
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: docker build
run: |
docker build . -t internap/fake-switches:latest
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}