forked from mattsta/signal-backup
-
-
Notifications
You must be signed in to change notification settings - Fork 54
99 lines (85 loc) · 2.41 KB
/
cicd.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
94
95
96
97
98
99
name: cicd
on:
push:
tags:
- '*'
branches: [ main ]
paths:
- '.github/workflows/cicd.yml'
- 'sigexport/**'
- '.dockerignore'
- 'Dockerfile'
- 'pyproject.toml'
schedule:
- cron: '0 2 2 * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- 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.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set tag env var
run: echo "TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV
- name: Docker Buildx base image
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
--output "type=image,push=true" \
--tag "carderne/sigexport:$TAG" \
--tag "carderne/sigexport:latest" \
--cache-from "carderne/sigexport:latest" \
--cache-to type=inline \
.
test:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set tag env var
run: echo "TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV
- uses: addnab/docker-run-action@v3
with:
image: "carderne/sigexport:${{ env.TAG }}"
options: -v ${{ github.workspace }}:/fresh
run: |
cd /fresh
pip install . pytest pytest-cov
pytest --cov sigexport
publish:
needs: test
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Release
uses: softprops/action-gh-release@v1
- name: Build
run: |
pip install build
python -m build
- name: Publish
# mimics: twine upload dist/* --skip-existing
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true