Skip to content

Commit

Permalink
build for focal and jammy
Browse files Browse the repository at this point in the history
  • Loading branch information
neolynx committed Apr 11, 2024
1 parent 3a29e08 commit 84c8678
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 20 deletions.
50 changes: 40 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.txt

release:
name: release
release-focal:
name: release-focal
needs: build
runs-on: ubuntu-22.04
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -115,19 +115,49 @@ jobs:
APTLY_USER: ${{ secrets.APTLY_USER }}
APTLY_PASSWORD: ${{ secrets.APTLY_PASSWORD }}
run: |
./upload-artifacts.sh nightly
./upload-artifacts.sh nightly focal
- name: Publish release to aptly
if: startsWith(github.event.ref, 'refs/tags')
env:
APTLY_USER: ${{ secrets.APTLY_USER }}
APTLY_PASSWORD: ${{ secrets.APTLY_PASSWORD }}
run: |
./upload-artifacts.sh release
./upload-artifacts.sh release focal
- name: Upload artifacts to GitHub Release
if: startsWith(github.event.ref, 'refs/tags')
uses: softprops/action-gh-release@v1
release-jammy:
name: release-jammy
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
body: Release ${{ github.ref }} generated by the CI.
files: build/*
# fetch the whole repot for `git describe` to
# work and get the nightly verion
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v4

- name: Make Release
env:
GOBIN: /usr/local/bin
run: |
make release
- name: Publish nightly release to aptly
if: github.ref == 'refs/heads/master'
env:
APTLY_USER: ${{ secrets.APTLY_USER }}
APTLY_PASSWORD: ${{ secrets.APTLY_PASSWORD }}
run: |
./upload-artifacts.sh nightly jammy
- name: Publish release to aptly
if: startsWith(github.event.ref, 'refs/tags')
env:
APTLY_USER: ${{ secrets.APTLY_USER }}
APTLY_PASSWORD: ${{ secrets.APTLY_PASSWORD }}
run: |
./upload-artifacts.sh release jammy
41 changes: 31 additions & 10 deletions upload-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,45 @@ aptly_password="$APTLY_PASSWORD"
aptly_api="https://aptly-ops.aptly.info"
version=`make version`

echo "Publishing version '$version' to $1..."
action=$1
action=$2

usage() {
echo "Usage: $0 nighly|release jammy|focal|bookworm" >&2
}

if [ -z "$action" ]; then
usage
exit 1
fi

if [ -z "$dist" ]; then
usage
exit 1
fi

echo "Publishing version '$version' to $action for $dist..."

for file in $packages; do
echo "Uploading $file..."
curl -fsS -X POST -F "file=@$file" -u $aptly_user:$aptly_password ${aptly_api}/api/files/$folder
echo
done

if [ "$1" = "nightly" ]; then
cleanup() {
curl -fsS -X DELETE -u $aptly_user:$aptly_password ${aptly_api}/api/files/$folder
echo
}
trap cleanup EXIT

if [ "$action" = "nightly" ]; then
if echo "$version" | grep -vq "+"; then
# skip nightly when on release tag
exit 0
fi

aptly_repository=aptly-nightly
aptly_published=s3:repo.aptly.info:./nightly
aptly_repository=aptly-nightly-$dist
aptly_published=s3:repo.aptly.info:./nightly-$dist

echo "Adding packages to $aptly_repository..."
curl -fsS -X POST -u $aptly_user:$aptly_password ${aptly_api}/api/repos/$aptly_repository/file/$folder
Expand All @@ -39,10 +62,10 @@ if [ "$1" = "nightly" ]; then
echo
fi

if [ "$1" = "release" ]; then
aptly_repository=aptly-release
aptly_snapshot=aptly-$version
aptly_published=s3:repo.aptly.info:./squeeze
if [ "$action" = "release" ]; then
aptly_repository=aptly-release-$dist
aptly_snapshot=aptly-$dist-$version
aptly_published=s3:repo.aptly.info:$dist

echo "Adding packages to $aptly_repository..."
curl -fsS -X POST -u $aptly_user:$aptly_password ${aptly_api}/api/repos/$aptly_repository/file/$folder
Expand All @@ -62,5 +85,3 @@ if [ "$1" = "release" ]; then
echo
fi

curl -fsS -X DELETE -u $aptly_user:$aptly_password ${aptly_api}/api/files/$folder
echo

0 comments on commit 84c8678

Please sign in to comment.