Browse Source

Update Scripts and Add Update Links workflow (#5)

pull/6/head
Vince Grassia 4 years ago committed by GitHub
parent
commit
58b7ff7274
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 55
      .github/workflows/update-links.yml
  2. 11
      bitwarden.ps1
  3. 7
      bitwarden.sh

55
.github/workflows/update-links.yml

@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
---
name: Update Links
on:
release:
types: [published]
jobs:
update-links:
name: Update Links
runs-on: ubuntu-20.04
steps:
- name: Login to Azure - Prod Subscription
uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a
with:
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
- name: Retrieve secrets
id: retrieve-secrets
uses: Azure/get-keyvault-secrets@80ccd3fafe5662407cc2e55f202ee34bfff8c403
with:
keyvault: "bitwarden-prod-kv"
secrets: "rebrandly-apikey"
- name: Update Bitwarden Script PowerShell Link
uses: bitwarden/gh-actions/update-rebrandly-link@9bc2bb10c26cb4d5a7c1d7c0d0285ae37588c847
with:
apikey: ${{ steps.retrieve-secrets.outputs.rebrandly-apikey }}
domain: "go.btwrdn.co"
slashtag: "bw-ps"
destination: "https://github.org/bitwarden/self-host/releases/download/${{ env.GITHUB_REF }}/bitwarden.ps1"
- name: Update Run Script PowerShell Link
uses: bitwarden/gh-actions/update-rebrandly-link@9bc2bb10c26cb4d5a7c1d7c0d0285ae37588c847
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/${{ env.GITHUB_REF }}/run.ps1"
- name: Update Bitwarden Script Shell Link
uses: bitwarden/gh-actions/update-rebrandly-link@9bc2bb10c26cb4d5a7c1d7c0d0285ae37588c847
with:
apikey: ${{ steps.retrieve-secrets.outputs.rebrandly-apikey }}
domain: "go.btwrdn.co"
slashtag: "bw-sh"
destination: "https://github.org/bitwarden/self-host/releases/download/${{ env.GITHUB_REF }}/bitwarden.sh"
- name: Update Run Script Shell Link
uses: bitwarden/gh-actions/update-rebrandly-link@9bc2bb10c26cb4d5a7c1d7c0d0285ae37588c847
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/${{ env.GITHUB_REF }}/run.sh"

11
bitwarden.ps1

@ -23,7 +23,8 @@ if ($output -eq "") { @@ -23,7 +23,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.45.2"
@ -33,14 +34,14 @@ $keyConnectorVersion = "1.0.0" @@ -33,14 +34,14 @@ $keyConnectorVersion = "1.0.0"
# 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 {
@ -77,7 +78,7 @@ See more at https://bitwarden.com/help/article/install-on-premise/#script-comman @@ -77,7 +78,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
}
}
@ -102,7 +103,7 @@ https://bitwarden.com, https://github.com/bitwarden @@ -102,7 +103,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

7
bitwarden.sh

@ -31,7 +31,8 @@ then @@ -31,7 +31,8 @@ then
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.45.2"
@ -47,7 +48,7 @@ echo "" @@ -47,7 +48,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
@ -61,7 +62,7 @@ function downloadRunFile() { @@ -61,7 +62,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
}

Loading…
Cancel
Save