-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (104 loc) · 3.34 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
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
name: Continuous Deployment
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
packages: write
attestations: write
id-token: write
jobs:
deployment:
runs-on: ubuntu-latest
steps:
-
name: Release Please Action
id: release-please
uses: googleapis/[email protected]
with:
release-type: python
manifest-file: .release-please-manifest.json
-
name: Checkout buckets code
if: ${{ steps.release-please.outputs.release_created }}
uses: actions/checkout@v3
with:
fetch-depth: 1
-
name: Create release tags
id: metadata
if: ${{ steps.release-please.outputs.release_created }}
run: |
echo "Creating release tags for docker image"
IMAGE="chimefrb/workflow"
GHCR_IMAGE="ghcr.io/chimefrb/workflow"
TAG=${{ steps.release-please.outputs.tag_name }}
echo "image=${IMAGE}:latest" >> $GITHUB_OUTPUT
echo "tagged_image=${IMAGE}:${TAG}" >> $GITHUB_OUTPUT
echo "ghcr_image=${GHCR_IMAGE}:latest" >> $GITHUB_OUTPUT
echo "ghcr_tagged_image=${GHCR_IMAGE}:${TAG}" >> $GITHUB_OUTPUT
-
name: Setup docker-buildx
id: buildx
if: ${{ steps.release-please.outputs.release_created }}
uses: docker/setup-buildx-action@v3
with:
install: true
-
name: Perform DockerHub Login
if: ${{ steps.release-please.outputs.release_created }}
uses: docker/login-action@v3
with:
username: ${{ secrets.CHIMEFRB_DOCKER_USERNAME }}
password: ${{ secrets.CHIMEFRB_DOCKER_PASSWORD }}
-
name: Perform GHCR Login
if: ${{ steps.release-please.outputs.release_created }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build & Push docker image
id: build
if: ${{ steps.release-please.outputs.release_created }}
uses: docker/build-push-action@v2
with:
context: .
target: production
file: Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
${{ steps.metadata.outputs.image }}
${{ steps.metadata.outputs.tagged_image }}
${{ steps.metadata.outputs.ghcr_image }}
${{ steps.metadata.outputs.ghcr_tagged_image }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
-
name: Install Poetry
if: ${{ steps.release-please.outputs.release_created }}
run: |
pipx install poetry
-
name: Setup Python
if: ${{ steps.release-please.outputs.release_created }}
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: poetry
-
name: Push to PyPI
if: ${{ steps.release-please.outputs.release_created }}
env:
WORKFLOW_PYPI_TOKEN: ${{ secrets.WORKFLOW_CORE_PYPI_TOKEN }}
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project false
poetry install
poetry config pypi-token.pypi $WORKFLOW_PYPI_TOKEN
poetry publish --build --verbose