-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (65 loc) · 2.46 KB
/
sign.yml
File metadata and controls
66 lines (65 loc) · 2.46 KB
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
name: Sign packages
# Trigger on pushes to main that add new debs (or this workflow)
on:
push:
branches:
- main
paths:
- 'core/**'
- 'workstation/**'
- '.github/workflows/sign.yml'
- '.github/workflows/build.py'
- '.github/workflows/listing.py'
- '.github/workflows/index.html.j2'
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
container: debian:bookworm
steps:
- name: Install dependencies
run: |
apt-get update
apt-get install --yes git git-lfs python3 python3-debian python3-jinja2 reprepro
- uses: actions/checkout@v4
with:
lfs: true
# Fetch all history for listing.py that looks at `git log`
fetch-depth: "0"
token: ${{ secrets.PUSH_TOKEN }}
- name: Configuration
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
run: |
echo "$SIGNING_KEY" | gpg --import -
git config --global --add safe.directory '*'
git config user.email "securedrop@freedom.press"
git config user.name "sdcibot"
- name: Clean old packages
run: |
find core -mindepth 1 -maxdepth 2 -type d | xargs -I '{}' ./scripts/clean-old-packages '{}' 4
find workstation -mindepth 1 -maxdepth 2 -type d | xargs -I '{}' ./scripts/clean-old-packages '{}' 4
git add .
- name: Sign packages
run: |
./.github/workflows/build.py
# If the only thing that build.py changed is repo/db/checksums.db, reset it
if [[ "$(git diff --name-only)" == "repo/db/checksums.db" ]]; then
git checkout repo/db/checksums.db
fi
git add .
- name: Update metadata
run: |
# Only run if we made changes above
if [[ -n "$(git diff --staged)" ]]; then
reprepro --basedir ./repo --outdir ./repo/public export
fi
./.github/workflows/listing.py
git add .
- name: git commit and push
run: |
# Index will be clean if there are no changes
git diff-index --quiet HEAD || git commit -m "Signing new packages"
git push origin main