-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (134 loc) · 3.79 KB
/
pipeline.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: CI pipeline
permissions:
contents: write
id-token: write
issues: write
pages: write
on:
pull_request:
branches:
- main
push:
branches:
- "main"
tags:
- '*'
jobs:
tests-and-coverage:
uses: ./.github/workflows/tests_and_coverage.yml
linting:
uses: ./.github/workflows/linting.yml
build:
uses: ./.github/workflows/build.yml
publish-pypi:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs:
- tests-and-coverage
- linting
- build
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
env:
url: https://pypi.org/p/vdoc
publish-docker:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs:
- tests-and-coverage
- linting
- build
env:
IMAGE_NAME: voraus.jfrog.io/docker-public/vdoc
JFROG_CLI_BUILD_NAME: vdoc/${{ github.ref_name }}
JFROG_CLI_BUILD_NUMBER: '1'
steps:
- uses: jfrog/setup-jfrog-cli@v4
env:
JF_URL: https://voraus.jfrog.io
with:
oidc-provider-name: voraus-github-organization
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Determine Docker tags
id: set-tags
run: |
TAG="${{ github.ref_name }}"
LATEST_TAG=$(git tag --sort=-v:refname | head -n 1)
TAGS="${IMAGE_NAME}:${TAG}"
if [[ "$TAG" == "$LATEST_TAG" ]]; then
TAGS="${TAGS},${IMAGE_NAME}:latest"
fi
echo "tags=$TAGS" >> $GITHUB_OUTPUT
- name: Build Docker Image(s)
run: |
IFS=',' read -ra TAG_ARRAY <<< "${{ steps.set-tags.outputs.tags }}"
TAG_OPTIONS=$(printf " -t %s" "${TAG_ARRAY[@]}")
jf docker build $TAG_OPTIONS .
- name: Push and scan Docker Image(s)
run: |
IFS=',' read -ra TAG_ARRAY <<< "${{ steps.set-tags.outputs.tags }}"
for TAG in "${TAG_ARRAY[@]}"; do
jf docker push "$TAG"
jf docker scan "$TAG"
done
- name: Publish Build Info
run: |
jf rt build-publish
create-github-release:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs:
- publish-docker
- publish-pypi
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run JReleaser
uses: jreleaser/release-action@v2
with:
version: 1.13.1
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_PROJECT_VERSION: ${{ github.ref_name }}
publish-docs:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs:
- tests-and-coverage
- linting
- build
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
name: docs
path: docs
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4