-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from ipinfo/usama/release-ppa
Release Automation - PPA
- Loading branch information
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Build and release ipinfo cli to PPA | ||
|
||
name: Push to PPA | ||
on: | ||
push: | ||
tags: | ||
- 'ipinfo-*' | ||
|
||
jobs: | ||
push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Extract CLI Name and Version | ||
run: | | ||
# Get the tag name from the event payload | ||
TAG_NAME=${{ github.ref_name }} | ||
# Use a regular expression to extract the CLI name and version | ||
if [[ $TAG_NAME =~ ^([^-]+)-([^-]+)$ ]]; then | ||
CLI_NAME="${BASH_REMATCH[1]}" | ||
CLI_VERSION="${BASH_REMATCH[2]}" | ||
echo "CLI Name: $CLI_NAME" | ||
echo "CLI Version: $CLI_VERSION" | ||
# Add to github env | ||
echo "CLI_NAME=$CLI_NAME" >> $GITHUB_ENV | ||
echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV | ||
else | ||
echo "Invalid tag format: $TAG_NAME" | ||
echo "Tag should be of format CLI-VSN. e.g. ipinfo-1.0.0" | ||
exit 1 | ||
fi | ||
- name: Import GPG | ||
uses: crazy-max/ghaction-import-gpg@v6 | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
|
||
- name: Install build dependencies | ||
run: sudo apt install devscripts debhelper dh-golang dput | ||
|
||
- name: Build source package | ||
run: debuild -us -uc -S -d | ||
|
||
- name: Sign source package | ||
run: | | ||
cd ./.. | ||
debsign -k ${{ secrets.GPG_KEY_ID }} ipinfo_${{ env.CLI_VERSION }}.dsc ipinfo_${{ env.CLI_VERSION }}_source.changes | ||
- name: Push to Launchpad | ||
run: | | ||
cd ./.. | ||
dput ppa:ipinfo/ppa ipinfo_${{ env.CLI_VERSION }}_source.changes |