Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/referrer #12

Merged
merged 3 commits into from
Mar 10, 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
12 changes: 3 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 17 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 17 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}/`)
Expand Down
Loading