From db727cd504b24a5ff174377ebe1984a069f4d3d3 Mon Sep 17 00:00:00 2001 From: Balint Molnar Date: Fri, 17 May 2024 15:37:19 +0200 Subject: [PATCH 1/6] Use authentication for curl during repo create --- .github/scripts/create_repos.sh | 11 +++++------ .github/workflows/site-deploy.yaml | 2 ++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/scripts/create_repos.sh b/.github/scripts/create_repos.sh index 781ffc5c..1bc35d77 100755 --- a/.github/scripts/create_repos.sh +++ b/.github/scripts/create_repos.sh @@ -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=100 | 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" @@ -53,7 +53,7 @@ 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" @@ -61,7 +61,6 @@ main() { 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." @@ -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" diff --git a/.github/workflows/site-deploy.yaml b/.github/workflows/site-deploy.yaml index 7ee73ffc..6a15735f 100644 --- a/.github/workflows/site-deploy.yaml +++ b/.github/workflows/site-deploy.yaml @@ -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 }}" From 733d6c7e06c04c54a7cfe0a173b43b7c0c382962 Mon Sep 17 00:00:00 2001 From: Balint Molnar Date: Fri, 17 May 2024 15:42:32 +0200 Subject: [PATCH 2/6] Run action in site-branch as well --- .github/workflows/site-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site-deploy.yaml b/.github/workflows/site-deploy.yaml index 6a15735f..4948e8b0 100644 --- a/.github/workflows/site-deploy.yaml +++ b/.github/workflows/site-deploy.yaml @@ -2,7 +2,7 @@ name: Deploy to GitHub Pages on: push: - branches: [site-v2] + branches: [site-v2, site] workflow_dispatch: permissions: From c0f4c13fb0a2691980f971bd8300a71334307611 Mon Sep 17 00:00:00 2001 From: Balint Molnar Date: Wed, 22 May 2024 11:09:34 +0200 Subject: [PATCH 3/6] Host only the three latest release because of ratelimit --- .github/scripts/create_repos.sh | 2 +- .github/workflows/site-deploy.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/create_repos.sh b/.github/scripts/create_repos.sh index 1bc35d77..7d6654b9 100755 --- a/.github/scripts/create_repos.sh +++ b/.github/scripts/create_repos.sh @@ -30,7 +30,7 @@ main() { while IFS= read -r repo; do package_name="${repo##*/}" - if release_ids=$(curl -fqs -H "Authorization: Bearer ${GH_TOKEN}" 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 diff --git a/.github/workflows/site-deploy.yaml b/.github/workflows/site-deploy.yaml index 4948e8b0..6a15735f 100644 --- a/.github/workflows/site-deploy.yaml +++ b/.github/workflows/site-deploy.yaml @@ -2,7 +2,7 @@ name: Deploy to GitHub Pages on: push: - branches: [site-v2, site] + branches: [site-v2] workflow_dispatch: permissions: From 6634951ddc703f9fa1d9398ee63b4297dee5c7b0 Mon Sep 17 00:00:00 2001 From: Balint Molnar Date: Wed, 22 May 2024 11:29:57 +0200 Subject: [PATCH 4/6] Add site branch back for testing --- .github/workflows/site-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site-deploy.yaml b/.github/workflows/site-deploy.yaml index 6a15735f..4948e8b0 100644 --- a/.github/workflows/site-deploy.yaml +++ b/.github/workflows/site-deploy.yaml @@ -2,7 +2,7 @@ name: Deploy to GitHub Pages on: push: - branches: [site-v2] + branches: [site-v2, site] workflow_dispatch: permissions: From 39ac17c9c6151c80476551a7ba51607bc7b19cd1 Mon Sep 17 00:00:00 2001 From: Balint Molnar Date: Wed, 22 May 2024 11:33:38 +0200 Subject: [PATCH 5/6] Remove site from branches --- .github/workflows/site-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site-deploy.yaml b/.github/workflows/site-deploy.yaml index 4948e8b0..6a15735f 100644 --- a/.github/workflows/site-deploy.yaml +++ b/.github/workflows/site-deploy.yaml @@ -2,7 +2,7 @@ name: Deploy to GitHub Pages on: push: - branches: [site-v2, site] + branches: [site-v2] workflow_dispatch: permissions: From eda49695e8ec1bcf123ab742496aa0b40f728080 Mon Sep 17 00:00:00 2001 From: Balint Molnar Date: Wed, 22 May 2024 11:42:21 +0200 Subject: [PATCH 6/6] Update github action runners to the latest --- .github/workflows/go.yml | 2 +- .github/workflows/site-deploy.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 69308ab3..e8daa6bf 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -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 diff --git a/.github/workflows/site-deploy.yaml b/.github/workflows/site-deploy.yaml index 6a15735f..3d4ac685 100644 --- a/.github/workflows/site-deploy.yaml +++ b/.github/workflows/site-deploy.yaml @@ -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: | @@ -53,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 @@ -63,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 @@ -111,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" @@ -125,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