-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (110 loc) · 3.9 KB
/
go.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
name: Goreleaser
on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to release' # Description for the input
required: true # Tag is required to trigger the workflow manually
permissions:
contents: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Set Repository Name
run: echo "REPO_NAME=${{ secrets.GITHUB_REPOSITORY }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
- name: Run GoReleaser
uses: goreleaser/[email protected]
with:
distribution: goreleaser
version: v1.26.2
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
PRIVATE_KEY_PATH: ${{ secrets.PRIVATE_KEY }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
- name: List keys
run: |
git checkout main
gpg -K
- name: Copy .deb files to ppa directory
run: |
mkdir -p ppa
cp dist/*.deb ppa/
- name: Install dpkg-dev tools
run: sudo apt-get update && sudo apt-get install -y dpkg-dev
- name: Generate Packages and Packages.gz
run: |
cd ppa
dpkg-scanpackages --multiversion . > Packages
gzip -k -f Packages
- name: Generate Release and Release.gpg
run: |
cd ppa
apt-ftparchive release . > Release
gpg --batch --default-key "[email protected]" -abs -o - Release > Release.gpg
- name: Generate InRelease
run: |
cd ppa
gpg --batch --default-key "[email protected]" --clearsign -o - Release > InRelease
- name: Create .list file
run: |
echo "deb [signed-by=/etc/apt/trusted.gpg.d/KEY.gpg] https://logfire-ai.github.io/cli ./" > ppa/my_list_file.list
- name: Fetch all branches
run: git fetch --all
- name: Checkout and Push to main
run: |
git config --local user.email "[email protected]"
git config --local user.name "Logfire"
git add ppa/*
git pull
git commit -m "Add generated PPA files"
git push origin main
- name: Clone gh-pages branch
run: |
git clone --branch gh-pages https://github.com/logfire-ai/cli.git gh-pages
- name: Copy ppa contents to gh-pages
run: |
cp -r ppa/* gh-pages/
- name: Create YUM repository using Docker
run: |
docker run --rm -v $PWD:/workspace -w /workspace centos:7 bash -c "
sed -i 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's|^#baseurl=http://mirror.centos.org/centos|baseurl=http://vault.centos.org/centos|g' /etc/yum.repos.d/CentOS-Base.repo
yum clean all
yum install -y createrepo rpm-sign
mkdir -p yum-repo
cp dist/*.rpm yum-repo/
echo '%_gpg_name [email protected]' > ~/.rpmmacros
for rpm in yum-repo/*.rpm; do
rpm --addsign \$rpm
done
createrepo yum-repo/"
- name: Copy YUM repo to gh-pages
run: |
mkdir -p gh-pages/yum-repo
cp -r yum-repo/* gh-pages/yum-repo/
- name: Commit and Push to gh-pages
run: |
cd gh-pages
git config --local user.email "[email protected]"
git config --local user.name "Logfire"
git remote set-url origin https://x-access-token:${{ secrets.TOKEN }}@github.com/logfire-ai/cli.git
git add .
git pull
git commit -m "Update GitHub Pages with YUM repo"
git push origin gh-pages
env:
GIT_CREDENTIALS: ${{ secrets.TOKEN }}