-
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (83 loc) · 2.7 KB
/
deploy_releases.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
name: Test and deploys releases
on:
push:
tags: 'v*'
jobs:
pytest:
uses: ./.github/workflows/unit_testing.yml
pypi:
name: Deploy to PyPI
needs:
- pytest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Get version from versioneer
run: |
VER=$(echo $(python -c "import versioneer; print(versioneer.get_versions()['version'].replace('+', '-'))"))
echo "VERSION=$VER" >> $GITHUB_ENV
- name: Install pypa/build and build a binary wheel and a source tarball
run: |
python -m pip install --upgrade pip
python -m pip install build --user
python -m build --sdist --wheel --outdir dist/ .
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Create Github release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
title: "v${{ env.VERSION }}"
files: |
LICENSE
dist/intrusion*
docker:
name: Deploy to Docker Hub (latest)
needs:
- pytest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Get version from versioneer
run: |
VER=$(echo $(python -c "import versioneer; print(versioneer.get_versions()['version'].replace('+', '-'))"))
echo "VERSION=$VER" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
build-args: |
VERSION=${{ env.VERSION }}
no-cache: true
platforms: linux/amd64,linux/arm64
push: true
tags: |
afonsoc12/intrusion-monitor:latest
afonsoc12/intrusion-monitor:v${{ env.VERSION }}
ghcr.io/afonsoc12/intrusion-monitor:latest
ghcr.io/afonsoc12/intrusion-monitor:v${{ env.VERSION }}