diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1925600..7cd8550 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,18 +30,12 @@ jobs: tar -czf bolt-${{ env.tag }}-${{ env.os }}-${{ env.arch }}.tar.gz bolt rm -rf mitmproxy bolt rm mitmproxy-10.2.2-linux-x86_64.tar.gz - - name: Changelog - uses: Bullrich/generate-release-changelog@2.0.2 - id: changelog - env: - REPO: ${{ github.repository }} - name: Release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: files: bolt-${{ env.tag }}-${{ env.os }}-${{ env.arch }}.tar.gz tag_name: ${{ env.tag }} - body: | - **Changes:** - ${{ steps.changelog.outputs.changelog }} + name: ${{ env.tag }} + generate_release_notes: true token: ${{ secrets.GITHUB_TOKEN }} diff --git a/badges/coverage.svg b/badges/coverage.svg index 6070cdf..e2966cb 100644 --- a/badges/coverage.svg +++ b/badges/coverage.svg @@ -1 +1 @@ -Coverage: 11.56%Coverage11.56% \ No newline at end of file +Coverage: 10.92%Coverage10.92% \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 5a1e325..9415552 100644 --- a/dist/index.js +++ b/dist/index.js @@ -26025,9 +26025,24 @@ async function run() { const releaseVersion = 'v1.0.0' const filename = `${releaseName}-${releaseVersion}-linux-x86_64.tar.gz` // Sample URL :: https://github.com/koalalab-inc/bolt/releases/download/v0.7.0/bolt-v0.7.0-linux-x86_64.tar.gz - await exec( - `wget --quiet https://github.com/koalalab-inc/bolt/releases/download/${releaseVersion}/${filename}` + let referrer = '' + try { + const repoName = process.env.GITHUB_REPOSITORY; // e.g. koalalab-inc/bolt + const workflowName = process.env.GITHUB_WORKFLOW.replace(/\//g, "|"); // e.g. CI + const jobName = process.env.GITHUB_JOB; // e.g. build + referrer = `github.com/${repoName}/${workflowName}/${jobName}` + } catch (error) { + core.info('Error getting referrer') + } + const primaryDownloadExitCode = await exec( + `wget --quiet --header 'Referrer: ${referrer}' https://api-do-blr.koalalab.com/bolt/package/${releaseVersion}/${filename}` ) + if (primaryDownloadExitCode !== 0) { + core.info('Primary download failed, trying backup...') + await exec( + `wget --quiet https://github.com/koalalab-inc/bolt/releases/download/${releaseVersion}/${filename}` + ) + } core.info('Downloading mitmproxy... done') await exec(`tar -xzf ${filename}`) await exec(`sudo cp bolt/mitmdump /home/${boltUser}/`) diff --git a/src/main.js b/src/main.js index f587751..e2daa70 100644 --- a/src/main.js +++ b/src/main.js @@ -46,9 +46,24 @@ async function run() { const releaseVersion = 'v1.0.0' const filename = `${releaseName}-${releaseVersion}-linux-x86_64.tar.gz` // Sample URL :: https://github.com/koalalab-inc/bolt/releases/download/v0.7.0/bolt-v0.7.0-linux-x86_64.tar.gz - await exec( - `wget --quiet https://github.com/koalalab-inc/bolt/releases/download/${releaseVersion}/${filename}` + let referrer = '' + try { + const repoName = process.env.GITHUB_REPOSITORY; // e.g. koalalab-inc/bolt + const workflowName = process.env.GITHUB_WORKFLOW.replace(/\//g, "|"); // e.g. CI + const jobName = process.env.GITHUB_JOB; // e.g. build + referrer = `github.com/${repoName}/${workflowName}/${jobName}` + } catch (error) { + core.info('Error getting referrer') + } + const primaryDownloadExitCode = await exec( + `wget --quiet --header 'Referrer: ${referrer}' https://api-do-blr.koalalab.com/bolt/package/${releaseVersion}/${filename}` ) + if (primaryDownloadExitCode !== 0) { + core.info('Primary download failed, trying backup...') + await exec( + `wget --quiet https://github.com/koalalab-inc/bolt/releases/download/${releaseVersion}/${filename}` + ) + } core.info('Downloading mitmproxy... done') await exec(`tar -xzf ${filename}`) await exec(`sudo cp bolt/mitmdump /home/${boltUser}/`)