-
Notifications
You must be signed in to change notification settings - Fork 154
167 lines (143 loc) · 4.48 KB
/
tag.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
156
157
158
159
160
161
162
163
164
165
166
167
name: Application Release
on:
push:
tags:
- 'v*'
jobs:
build_release_assets:
uses: ./.github/workflows/build_release_assets.yml
secrets: inherit
with:
release_mode: true
push_to_pypi:
needs: build_release_assets
runs-on: ubuntu-22.04
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Download wheel and sdist
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
release:
runs-on: ubuntu-22.04
needs: build_release_assets
continue-on-error: true
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
# This is required for `gh release create` to work
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Read info
id: tags
shell: bash
run: |
echo "tag=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Download OS packages
uses: actions/download-artifact@v4
with:
pattern: os-packages-*
path: packages
merge-multiple: true
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create --draft ${{ steps.tags.outputs.tag }}
- name: Upload release assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload \
${{ steps.tags.outputs.tag }} \
packages/ggshield-*.pkg \
packages/ggshield_*.deb \
packages/ggshield-*.rpm \
packages/ggshield-*.gz
push_to_docker_hub:
name: Push Docker image to Docker Hub
runs-on: ubuntu-22.04
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and push
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: gitguardian/ggshield
tag_with_ref: true
tags: latest
push_to_github_packages:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-22.04
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Push to GitHub Packages
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: gitguardian/ggshield/ggshield
tag_with_ref: true
tags: latest
push_to_tap:
needs: push_to_pypi
name: Push to GitGuardian taps
runs-on: ubuntu-22.04
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
steps:
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Checkout Homebrew-tap
uses: actions/checkout@v4
with:
repository: GitGuardian/homebrew-tap
token: ${{ secrets.PAT_GITHUB }}
- name: Update Homebrew-tap
run: |
version=${GITHUB_REF/refs\/tags\/v/}
git config user.name github-actions
git config user.email [email protected]
scripts/update-ggshield --commit "$version"
git push
push_to_cloudsmith:
needs: build_release_assets
runs-on: ubuntu-22.04
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download packages
uses: actions/download-artifact@v4
with:
pattern: os-packages-*
path: packages
merge-multiple: true
- name: Install Cloudsmith CLI
run: pip install cloudsmith-cli
- name: Push to Cloudsmith
run: |
scripts/push-to-cloudsmith
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}