Skip to content

Commit

Permalink
build: initial version of a packagecloud.io pcp release repo
Browse files Browse the repository at this point in the history
Relates to #1771
  • Loading branch information
natoscott committed Sep 5, 2023
1 parent b2ce1f2 commit 1c7f060
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 18 deletions.
44 changes: 26 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Deploys PCP to JFrog Artifactory
# Deploys PCP to Packagecloud
name: Release
on:
push:
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
path: artifacts/test

release:
name: Release on Artifactory
name: Release packages
if: github.repository == 'performancecopilot/pcp' || github.event_name == 'workflow_dispatch'
needs: qa
runs-on: ubuntu-latest
Expand All @@ -97,6 +97,9 @@ jobs:
with:
path: artifacts

- name: Discover artifacts
run: find artifacts | xargs ls -l

- name: Create source tarball
run: ./Makepkgs --source --nonrpm

Expand All @@ -111,20 +114,25 @@ jobs:
archives/*
build/tar/*.src.tar.gz
- name: Release on Artifactory
run: |
export PYTHONUNBUFFERED=1
. VERSION.pcp
build/ci/artifactory.py deploy \
--maturity release \
--version "$PACKAGE_MAJOR.$PACKAGE_MINOR.$PACKAGE_REVISION" \
--build_name "${GITHUB_WORKFLOW}" \
--build_number "${GITHUB_RUN_ID}" \
--source build/tar/*.src.tar.gz \
--exclude 'pcp-testsuite.*' \
--exclude 'pcp-.+\.src\.rpm' \
artifacts/build-*
- name: Release on Packagecloud
run: build/ci/packagecloud.sh
env:
ARTIFACTORY_USER: github-actions
ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }}
ARTIFACTORY_GPG_PASSPHRASE: ${{ secrets.ARTIFACTORY_GPG_PASSPHRASE }}
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}

# - name: Release on Artifactory
# run: |
# export PYTHONUNBUFFERED=1
# . VERSION.pcp
# build/ci/artifactory.py deploy \
# --maturity release \
# --version "$PACKAGE_MAJOR.$PACKAGE_MINOR.$PACKAGE_REVISION" \
# --build_name "${GITHUB_WORKFLOW}" \
# --build_number "${GITHUB_RUN_ID}" \
# --source build/tar/*.src.tar.gz \
# --exclude 'pcp-testsuite.*' \
# --exclude 'pcp-.+\.src\.rpm' \
# artifacts/build-*
# env:
# ARTIFACTORY_USER: github-actions
# ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }}
# ARTIFACTORY_GPG_PASSPHRASE: ${{ secrets.ARTIFACTORY_GPG_PASSPHRASE }}
44 changes: 44 additions & 0 deletions build/ci/packagecloud.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/sh
# Based on an (one file at a time) upload script here:
#https://github.com/danielmundi/upload-packagecloud/blob/main/push.sh

set -e

echo "Install dependencies"
sudo gem install package_cloud

user=performancecopilot
repo=pcp

# Iterate each of the builds
for build in artifacts/build-*
do
[ $build = "artifacts/build-*" ] && continue

# ex. artifacts/build-fedora31-container
dist=`echo $build | sed -e 's/^.*build-//' -e 's/-container$//' | awk '
BEGIN {
# map to any code names packagecloud expects
dist["debian10"] = "debian/buster";
dist["debian11"] = "debian/bullseye";
dist["debian12"] = "debian/bookworm";
dist["debian13"] = "debian/trixie";
dist["ubuntu1804"] = "ubuntu/bionic";
dist["ubuntu2004"] = "ubuntu/focal";
dist["ubuntu2204"] = "ubuntu/jammy";
}
$1 ~ /^debian/ || /^ubuntu/ { print dist[$1] }
$1 ~ /^fedora/ { match($1, /f.*([1-9][0-9]*)/, m); printf "fedora/%s\n", m[1] }
$1 ~ /^centos/ { match($1, /c.*([1-9][0-9]*)/, m); printf "el/%s\n", m[1] }
'`
[ -z "$dist" ] && continue

echo "Upload $dist packages"
pushd $build
for file in `find . -name \*.rpm -o -name \*.deb | grep -Ev 'tests|\.src\.'`
do
echo package_cloud push $user/$repo/$dist/pcp $file
package_cloud push $user/$repo/$dist/pcp $file
done
popd
done

0 comments on commit 1c7f060

Please sign in to comment.