-
Notifications
You must be signed in to change notification settings - Fork 24
45 lines (40 loc) · 1.49 KB
/
cd.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
name: "Continuous Deployment"
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: "Setup Python, Poetry and Dependencies"
uses: packetcoders/action-setup-cache-python-poetry@main
with:
python-version: "${{ vars.PRIMARY_PYTHON_VERSION }}"
poetry-version: "${{ vars.POETRY_VERSION }}"
- name: Install Task
run: |
sudo sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
- name: Install the library
run: poetry install --no-interaction --only-root
- name: Run CI-CD-checks
run: poetry run task ci-cd-checks
- name: Publish package
run: |
# Use GitHub's run_number as a post-release version identifier
if [[ "${{ github.event_name }}" == "workflow_dispatch" || "${{ github.ref }}" == 'refs/heads/main' ]]; then
POETRY_VERSION=$(poetry version | awk '{print $2}')
NEW_VERSION="${POETRY_VERSION}.post${{ github.run_number }}"
poetry version "${NEW_VERSION}"
fi
poetry build
poetry publish --username __token__ --password ${{ secrets.PUBLIC_PYPI_API_TOKEN }}
- name: Initiate Website Deployment
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.CI_CD_TRIGGER_GITHUB_TOKEN }}
repository: alphanome-ai/sec-ai-deploy
event-type: trigger-ci-cd