1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-28 12:45:45 +01:00

starting the deploy breakout

This commit is contained in:
Joseph Flinn 2021-01-29 19:09:59 +00:00
parent f37461d742
commit e545ecd165
2 changed files with 117 additions and 33 deletions

View File

@ -1,57 +1,146 @@
name: Deploy name: Deploy
on: on:
workflow_dispatch:
inputs:
release_tag_name_input:
description: "Release Tag Name <X.X.X>"
required: true
release: release:
types: types:
- prereleased - published
jobs: jobs:
setup: setup:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
package_version: ${{ steps.get_pkg_version.outputs.package_version }} package_version: ${{ steps.create_tags.outputs.package_version }}
tag_version: ${{ steps.get_pkg_version.outputs.tag_version }} tag_version: ${{ steps.create_tags.outputs.tag_version }}
steps: steps:
- name: Checkout Repo - name: Checkout Repo
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Get package version - name: Create Deploy version vars
id: get_pkg_version id: create_tags
run: | run: |
if ! [[ "${{ github.event_name }}" -eq "release" ]]; then
case "${RELEASE_TAG_NAME_INPUT:0:1}" in
v)
echo "RELEASE_NAME=${RELEASE_TAG_NAME_INPUT:1}" >> $GITHUB_ENV
echo "RELEASE_TAG_NAME=$RELEASE_TAG_NAME_INPUT" >> $GITHUB_ENV
echo "::set-output name=package_version::${RELEASE_TAG_NAME_INPUT:1}"
echo "::set-output name=tag_version::$RELEASE_TAG_NAME_INPUT"
;;
[0-9])
echo "RELEASE_NAME=$RELEASE_TAG_NAME_INPUT" >> $GITHUB_ENV
echo "RELEASE_TAG_NAME=v$RELEASE_TAG_NAME_INPUT" >> $GITHUB_ENV
echo "::set-output name=package_version::$RELEASE_TAG_NAME_INPUT"
echo "::set-output name=tag_version::v$RELEASE_TAG_NAME_INPUT"
;;
*)
exit 1
;;
esac
else
TAG_VERSION=$(echo ${{ github.ref }} | cut -d "/" -f 3) TAG_VERSION=$(echo ${{ github.ref }} | cut -d "/" -f 3)
PKG_VERSION=${TAG_VERSION:1} PKG_VERSION=${TAG_VERSION:1}
echo "::set-output name=package_version::$PKG_VERSION" echo "::set-output name=package_version::$PKG_VERSION"
echo "::set-output name=tag_version::$TAG_VERSION" echo "::set-output name=tag_version::$TAG_VERSION"
fi
env:
RELEASE_TAG_NAME_INPUT: ${{ github.event.inputs.release_tag_name_input }}
linux: snap:
name: Deploy Snap
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: setup needs: setup
env:
PKG_VERSION: ${{ needs.setup.outputs.package_version }}
TAG_VERSION: ${{ needs.setup.ouputs.tag_version }}
steps: steps:
- name: Checkout Repo - name: Checkout Repo
uses: actions/checkout@v2 uses: actions/checkout@v2
#- name: Install Snap - name: Install Snap
# uses: samuelmeuli/action-snapcraft@v1 uses: samuelmeuli/action-snapcraft@v1
# with: # with:
# snapcraft_token: ${{ secrets.SNAP_TOKEN }} # snapcraft_token: ${{ secrets.SNAP_TOKEN }}
- name: Get snap release asset - name: setup
uses: dsaltares/fetch-gh-release-asset@master run: mkdir dist
- name: get snap package
uses: Xotl/cool-github-releases@v1
with: with:
version: tags/${{ env.TAG_VERSION }} mode: download
file: bitwarden_${{ env.PKG_VERSION }}_amd64.snap tag_name: ${{ env.TAG_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }} assets: bitwarden_${{ env.PKG_VERSION }}_amd64.snap|./dist/bitwarden_${{ env.PKG_VERSION }}_amd64.snap
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: test
run: ls -alht dist
- name: Deploy to Snap Store
if: false
run: |
snapcraft upload dist/bitwarden_${{ env.PACKAGE_VERSION }}_amd64.snap --release stable
snapcraft logout
choco:
name: Deploy Choco
runs-on: windows-latest
needs: setup
env: env:
PKG_VERSION: ${{ needs.setup.outputs.package_version }} PKG_VERSION: ${{ needs.setup.outputs.package_version }}
TAG_VERSION: ${{ needs.setup.outputs.tag_version }} TAG_VERSION: ${{ needs.setup.outputs.tag_version }}
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: testing - name: Get choco release asset
run: ls -atlh uses: dsaltares/fetch-gh-release-asset@0.0.5
with:
version: tags/${{ env.TAG_VERSION }}
file: bitwarden.${{ env.PKG_VERSION }}.nupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#- name: Deploy to Snap Store #- name: Setup Chocolatey
# run: | # run: choco apikey --key $env:CHOCO_API_KEY --source https://push.chocolatey.org/
# snapcraft upload dist/bitwarden_${{ env.PACKAGE_VERSION }}_amd64.snap --release stable # env:
# snapcraft logout # CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }}
- name: make dist dir
shell: pwsh
run: New-Item -ItemType directory -Path ./dist
- name: Get nupkg
uses: Xotl/cool-github-releases@v1
with:
mode: download
tag_name: ${{ env.TAG_VERSION }}
assets: bitwarden.${{ env.PKG_VERSION }}.nupkg|./dist/bitwarden.${{ env.PKG_VERSION }}.nupkg
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Push to Chocolatey
if: false
shell: pwsh
run: |
cd dist
choco push
# Placeholder until the build thing works with the directory-connector
macos:
runs-on: macos-latest
if: false
needs: setup
steps:
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: '10.x'

View File

@ -68,15 +68,10 @@ jobs:
sudo apt-get update sudo apt-get update
sudo apt-get -y install pkg-config libxss-dev libsecret-1-dev rpm sudo apt-get -y install pkg-config libxss-dev libsecret-1-dev rpm
- name: Install Snap
uses: samuelmeuli/action-snapcraft@v1
- name: Print environment - name: Print environment
run: | run: |
node --version node --version
npm --version npm --version
snap --version
snapcraft --version || echo 'snapcraft unavailable'
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -99,7 +94,6 @@ jobs:
windows-signed: windows-signed:
runs-on: windows-latest runs-on: windows-latest
if: false
needs: setup needs: setup
steps: steps:
- name: Set up dotnet - name: Set up dotnet
@ -174,7 +168,7 @@ jobs:
SIGNING_CERT_NAME: ${{ secrets.SIGNING_CERT_NAME }} SIGNING_CERT_NAME: ${{ secrets.SIGNING_CERT_NAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy to Chocolatey - name: Package Chocolatey
shell: pwsh shell: pwsh
run: | run: |
Copy-Item -Path ./stores/chocolatey -Destination ./dist/chocolatey -Recurse Copy-Item -Path ./stores/chocolatey -Destination ./dist/chocolatey -Recurse
@ -183,9 +177,11 @@ jobs:
$checksum = checksum -t sha256 ./dist/chocolatey/Bitwarden-Installer-${{ env.PACKAGE_VERSION }}.exe $checksum = checksum -t sha256 ./dist/chocolatey/Bitwarden-Installer-${{ env.PACKAGE_VERSION }}.exe
$chocoInstall = "./dist/chocolatey/tools/chocolateyinstall.ps1" $chocoInstall = "./dist/chocolatey/tools/chocolateyinstall.ps1"
(Get-Content $chocoInstall).replace('__version__', "$env:PACKAGE_VERSION").replace('__checksum__', $checksum) | Set-Content $chocoInstall (Get-Content $chocoInstall).replace('__version__', "$env:PACKAGE_VERSION").replace('__checksum__', $checksum) | Set-Content $chocoInstall
ls -alht dist/chocolatey
choco pack ./dist/chocolatey/bitwarden.nuspec --version "$env:PACKAGE_VERSION" --out ./dist/chocolatey choco pack ./dist/chocolatey/bitwarden.nuspec --version "$env:PACKAGE_VERSION" --out ./dist/chocolatey
cd ./dist/chocolatey cd ./dist/chocolatey
choco push ls -alht dist/chocolatey
#choco push
- name: Upload Chocolatey nupkg release asset - name: Upload Chocolatey nupkg release asset
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
@ -200,7 +196,6 @@ jobs:
windows-store: windows-store:
runs-on: windows-latest runs-on: windows-latest
if: false
needs: setup needs: setup
steps: steps:
- name: Set up Node - name: Set up Node