Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Host only the three latest release and use authentication #149

Merged
merged 6 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/scripts/create_repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ main() {
while IFS= read -r repo;
do
package_name="${repo##*/}"
if release_ids=$(curl -fqs https://api.github.com/repos/${repo}/releases?per_page=100 | jq -r '.[].id')
if release_ids=$(curl -fqs -H "Authorization: Bearer ${GH_TOKEN}" https://api.github.com/repos/${repo}/releases?per_page=3 | jq -r '.[].id')
then
for release_id in $release_ids;
do
echo "Processing release ID: $release_id for $package_name"
response=$(curl -fsS https://api.github.com/repos/${repo}/releases/${release_id}/assets)
response=$(curl -fsS -H "Authorization: Bearer ${GH_TOKEN}" https://api.github.com/repos/${repo}/releases/${release_id}/assets)
curl_status=$?
if [ $curl_status -ne 0 ]; then
echo "Curl failed with status: $curl_status"
Expand All @@ -53,15 +53,14 @@ main() {
mkdir -p "${DEB_POOL}/${package_name}"
pushd "${DEB_POOL}/${package_name}" >/dev/null
echo "Getting DEB"
curl -LOJ -H "Accept: application/octet-stream" "https://api.github.com/repos/${repo}/releases/assets/${deb_asset_id}"
curl -LOJ -H "Accept: application/octet-stream" -H "Authorization: Bearer ${GH_TOKEN}" "https://api.github.com/repos/${repo}/releases/assets/${deb_asset_id}"
curl_status=$?
if [ $curl_status -ne 0 ]; then
echo "Curl failed with status: $curl_status"
exit 1
fi
popd >/dev/null
done

rpm_asset_ids=$(echo "$response" | jq -r '.[] | select(.name | endswith(".rpm")) | .id')
if [ -z "$rpm_asset_ids" ]; then
echo "No .rpm assets found."
Expand All @@ -73,8 +72,8 @@ main() {
mkdir -p generated_repo/rpm
pushd generated_repo/rpm >/dev/null
echo "Getting RPM"
rpm_file=$(curl -fqs https://api.github.com/repos/${repo}/releases/assets/${rpm_asset_id} | jq -r '.name')
curl -LOJ -H "Accept: application/octet-stream" "https://api.github.com/repos/${repo}/releases/assets/${rpm_asset_id}"
rpm_file=$(curl -fqs -H "Authorization: Bearer ${GH_TOKEN}" https://api.github.com/repos/${repo}/releases/assets/${rpm_asset_id} | jq -r '.name')
curl -LOJ -H "Accept: application/octet-stream" -H "Authorization: Bearer ${GH_TOKEN}" "https://api.github.com/repos/${repo}/releases/assets/${rpm_asset_id}"
curl_status=$?
if [ $curl_status -ne 0 ]; then
echo "Curl failed with status: $curl_status"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v3
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/site-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install required packages
run: |
Expand All @@ -38,6 +38,8 @@ jobs:
gpg_private_key: ${{ secrets.PGP_PRIVATE_KEY }}

- name: Build DEB/RPM Repos
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export GPG_FINGERPRINT="${{ steps.import_gpg.outputs.fingerprint }}"
export ORIGIN="${{ steps.import_gpg.outputs.name }}"
Expand All @@ -51,7 +53,7 @@ jobs:
done

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
path: "./generated_repo"
name: repo
Expand All @@ -61,7 +63,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v2
Expand Down Expand Up @@ -109,7 +111,7 @@ jobs:
cp ./deploy/install.sh ./site/landing/dist/install.sh

- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
path: "./site/landing/dist"

Expand All @@ -123,7 +125,7 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4

test-package:
needs: deploy
Expand Down
Loading