Skip to content

Commit 46b2e18

Browse files
authored
Merge pull request #181 from ipinfo/usama/release-ppa
Release Automation - PPA
2 parents 5040fa4 + a166d91 commit 46b2e18

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/cd_ppa.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Build and release ipinfo cli to PPA
2+
3+
name: Push to PPA
4+
on:
5+
push:
6+
tags:
7+
- 'ipinfo-*'
8+
9+
jobs:
10+
push:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
17+
- name: Extract CLI Name and Version
18+
run: |
19+
# Get the tag name from the event payload
20+
TAG_NAME=${{ github.ref_name }}
21+
22+
# Use a regular expression to extract the CLI name and version
23+
if [[ $TAG_NAME =~ ^([^-]+)-([^-]+)$ ]]; then
24+
CLI_NAME="${BASH_REMATCH[1]}"
25+
CLI_VERSION="${BASH_REMATCH[2]}"
26+
27+
echo "CLI Name: $CLI_NAME"
28+
echo "CLI Version: $CLI_VERSION"
29+
30+
# Add to github env
31+
echo "CLI_NAME=$CLI_NAME" >> $GITHUB_ENV
32+
echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV
33+
else
34+
echo "Invalid tag format: $TAG_NAME"
35+
echo "Tag should be of format CLI-VSN. e.g. ipinfo-1.0.0"
36+
exit 1
37+
fi
38+
39+
- name: Import GPG
40+
uses: crazy-max/ghaction-import-gpg@v6
41+
with:
42+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
43+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
44+
45+
- name: Install build dependencies
46+
run: sudo apt install devscripts debhelper dh-golang dput
47+
48+
- name: Build source package
49+
run: debuild -us -uc -S -d
50+
51+
- name: Sign source package
52+
run: |
53+
cd ./..
54+
debsign -k ${{ secrets.GPG_KEY_ID }} ipinfo_${{ env.CLI_VERSION }}.dsc ipinfo_${{ env.CLI_VERSION }}_source.changes
55+
56+
- name: Push to Launchpad
57+
run: |
58+
cd ./..
59+
dput ppa:ipinfo/ppa ipinfo_${{ env.CLI_VERSION }}_source.changes

0 commit comments

Comments
 (0)