-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (124 loc) · 5.06 KB
/
ci.yaml
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
name: CI
on:
workflow_dispatch:
push:
branches:
- main
jobs:
release:
if: ${{ github.event_name == 'workflow_dispatch' }}
permissions:
id-token: "write"
packages: "write"
name: release
runs-on: ubuntu-22.04
outputs:
tag_name: ${{ steps.draft_release.outputs.tag_name }}
steps:
- name: Checkout action code
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
fetch-depth: 0
- name: Create GitHub App Token
id: app-token
uses: actions/create-github-app-token@a0de6af83968303c8c955486bf9739a57d23c7f1 # v1.10.0
with:
app-id: ${{ secrets.VERSION_CLI_UPDATER_APP_ID }}
private-key: ${{ secrets.VERSION_CLI_UPDATER_PRIVATE_KEY }}
- name: Draft release
id: draft_release
uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6.0.0
with:
disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- name: Login to GitHub Container Registry
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
run: VERSION=${{ steps.draft_release.outputs.tag_name }} make docker-push
- name: Publish release
uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6.0.0
if: steps.draft_release.outputs.tag_name != ''
with:
version: ${{ steps.draft_release.outputs.tag_name }}
publish: true
disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Checkout action code
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
fetch-depth: 0
ref: ${{ steps.draft_release.outputs.tag_name }}
- name: Setup Go environment
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: "go.mod"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
with:
version: v1.25.1 # renovate: datasource=github-tags depName=goreleaser/goreleaser
args: release --skip=publish --clean
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
GORELEASER_CURRENT_TAG: ${{ steps.draft_release.outputs.tag_name }}
- name: Upload files
run: |
gh release upload --clobber ${{ env.VERSION }} ${{ env.FILES }}
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
VERSION: ${{ steps.draft_release.outputs.tag_name }}
FILES: dist/version_*.tar.gz dist/version_*.zip dist/version_*_checksums.txt
docs-deploy:
runs-on: ubuntu-22.04
if: ${{ always() }}
needs: release
permissions:
contents: write
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
fetch-depth: 0
- name: Configure Git Credentials
run: |
git config user.name version-cli[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Install Poetry
# renovate: datasource=github-tags depName=poetry packageName=python-poetry/poetry
run: pipx install poetry==1.8.2
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5
with:
python-version-file: pyproject.toml
cache: "poetry"
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: poetry install --no-interaction
- name: Fetch gh-pages remote changes (if any)
run: git fetch origin gh-pages --depth=1
- name: Deploy main docs
if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }}
run: poetry run mike deploy --push main
env:
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
MKDOCS_GIT_COMMITTERS_APIKEY: ${{ github.token }}
EXCLUDE_SHIELDS_IO_PRIVACY: true
- name: Deploy release docs
if: ${{ github.event_name == 'workflow_dispatch' && needs.release.result == 'success' }}
run: |-
FULL_TAG="${{ needs.release.outputs.tag_name }}"
TAG=$(echo "$FULL_TAG" | sed 's/\.[0-9]*$/\.x/')
poetry run mike deploy --push --update-aliases ${{ needs.release.outputs.tag_name }} latest
env:
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
MKDOCS_GIT_COMMITTERS_APIKEY: ${{ github.token }}