From a4305ca7f8ae2b3aff211fa1f7d9c9eca2393046 Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Tue, 1 Mar 2022 15:07:02 -0500 Subject: [PATCH] Update 'update-rebrandly-link' action (#12) --- .github/workflows/update-links.yml | 16 ++++++++-------- bitwarden.ps1 | 11 ++++++----- bitwarden.sh | 7 ++++--- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/update-links.yml b/.github/workflows/update-links.yml index 5ceaeaa..77eda4d 100644 --- a/.github/workflows/update-links.yml +++ b/.github/workflows/update-links.yml @@ -37,33 +37,33 @@ jobs: fi - name: Update Bitwarden Script PowerShell Link - uses: bitwarden/gh-actions/update-rebrandly-link@664c8899c95490c65dac0df11519d24ed8419c85 + uses: bitwarden/gh-actions/update-rebrandly-link@340a677ffb0c53e50ca67cd2c12044cd7f7fc725 with: apikey: ${{ steps.retrieve-secrets.outputs.rebrandly-apikey }} domain: "go.btwrdn.co" slashtag: "bw-ps" - destination: "https://github.org/bitwarden/self-host/releases/download/${{ steps.tag-name.outputs.value }}/bitwarden.ps1" + destination: "https://github.com/bitwarden/self-host/releases/download/${{ steps.tag-name.outputs.value }}/bitwarden.ps1" - name: Update Run Script PowerShell Link - uses: bitwarden/gh-actions/update-rebrandly-link@664c8899c95490c65dac0df11519d24ed8419c85 + uses: bitwarden/gh-actions/update-rebrandly-link@340a677ffb0c53e50ca67cd2c12044cd7f7fc725 with: apikey: ${{ steps.retrieve-secrets.outputs.rebrandly-apikey }} domain: "go.btwrdn.co" slashtag: "bw-ps-run" - destination: "https://github.org/bitwarden/self-host/releases/download/${{ steps.tag-name.outputs.value }}/run.ps1" + destination: "https://github.com/bitwarden/self-host/releases/download/${{ steps.tag-name.outputs.value }}/run.ps1" - name: Update Bitwarden Script Shell Link - uses: bitwarden/gh-actions/update-rebrandly-link@664c8899c95490c65dac0df11519d24ed8419c85 + uses: bitwarden/gh-actions/update-rebrandly-link@340a677ffb0c53e50ca67cd2c12044cd7f7fc725 with: apikey: ${{ steps.retrieve-secrets.outputs.rebrandly-apikey }} domain: "go.btwrdn.co" slashtag: "bw-sh" - destination: "https://github.org/bitwarden/self-host/releases/download/${{ steps.tag-name.outputs.value }}/bitwarden.sh" + destination: "https://github.com/bitwarden/self-host/releases/download/${{ steps.tag-name.outputs.value }}/bitwarden.sh" - name: Update Run Script Shell Link - uses: bitwarden/gh-actions/update-rebrandly-link@664c8899c95490c65dac0df11519d24ed8419c85 + uses: bitwarden/gh-actions/update-rebrandly-link@340a677ffb0c53e50ca67cd2c12044cd7f7fc725 with: apikey: ${{ steps.retrieve-secrets.outputs.rebrandly-apikey }} domain: "go.btwrdn.co" slashtag: "bw-sh-run" - destination: "https://github.org/bitwarden/self-host/releases/download/${{ steps.tag-name.outputs.value }}/run.sh" + destination: "https://github.com/bitwarden/self-host/releases/download/${{ steps.tag-name.outputs.value }}/run.sh" diff --git a/bitwarden.ps1 b/bitwarden.ps1 index e57c7ad..4e03a57 100644 --- a/bitwarden.ps1 +++ b/bitwarden.ps1 @@ -24,7 +24,8 @@ if ($output -eq "") { } $scriptsDir = "${output}\scripts" -$githubBaseUrl = "https://raw.githubusercontent.com/bitwarden/server/master" +$bitwardenScriptUrl = "https://go.btwrdn.co/bw-ps" +$runScriptUrl = "https://go.btwrdn.co/bw-ps-run" # Please do not create pull requests modifying the version numbers. $coreVersion = "1.46.2" @@ -34,14 +35,14 @@ $keyConnectorVersion = "1.0.1" # Functions function Get-Self { - Invoke-RestMethod -OutFile $scriptPath -Uri "${githubBaseUrl}/scripts/bitwarden.ps1" + Invoke-RestMethod -OutFile $scriptPath -Uri $bitwardenScriptUrl } function Get-Run-File { if (!(Test-Path -Path $scriptsDir)) { New-Item -ItemType directory -Path $scriptsDir | Out-Null } - Invoke-RestMethod -OutFile $scriptsDir\run.ps1 -Uri "${githubBaseUrl}/scripts/run.ps1" + Invoke-RestMethod -OutFile $scriptsDir\run.ps1 -Uri $runScriptUrl } function Test-Output-Dir-Exists { @@ -79,7 +80,7 @@ See more at https://bitwarden.com/help/article/install-on-premise/#script-comman } function Write-Line($str) { - if($env:BITWARDEN_QUIET -ne "true") { + if ($env:BITWARDEN_QUIET -ne "true") { Write-Host $str } } @@ -104,7 +105,7 @@ https://bitwarden.com, https://github.com/bitwarden =================================================== " -if($env:BITWARDEN_QUIET -ne "true") { +if ($env:BITWARDEN_QUIET -ne "true") { Write-Line "bitwarden.ps1 version ${coreVersion}" docker --version docker-compose --version diff --git a/bitwarden.sh b/bitwarden.sh index 013e7d2..3d410aa 100755 --- a/bitwarden.sh +++ b/bitwarden.sh @@ -37,7 +37,8 @@ else fi SCRIPTS_DIR="$OUTPUT/scripts" -GITHUB_BASE_URL="https://raw.githubusercontent.com/bitwarden/server/master" +BITWARDEN_SCRIPT_URL="https://go.btwrdn.co/bw-sh" +RUN_SCRIPT_URL="https://go.btwrdn.co/bw-sh-run" # Please do not create pull requests modifying the version numbers. COREVERSION="1.46.2" @@ -57,7 +58,7 @@ echo "" # Functions function downloadSelf() { - if curl -s -w "http_code %{http_code}" -o $SCRIPT_PATH.1 $GITHUB_BASE_URL/scripts/bitwarden.sh | grep -q "^http_code 20[0-9]" + if curl -L -s -w "http_code %{http_code}" -o $SCRIPT_PATH.1 $BITWARDEN_SCRIPT_URL | grep -q "^http_code 20[0-9]" then mv $SCRIPT_PATH.1 $SCRIPT_PATH chmod u+x $SCRIPT_PATH @@ -71,7 +72,7 @@ function downloadRunFile() { then mkdir $SCRIPTS_DIR fi - curl -s -o $SCRIPTS_DIR/run.sh $GITHUB_BASE_URL/scripts/run.sh + curl -L -s -o $SCRIPTS_DIR/run.sh $RUN_SCRIPT_URL chmod u+x $SCRIPTS_DIR/run.sh rm -f $SCRIPTS_DIR/install.sh }