diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ce0a04f96..95817329a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -184,6 +184,17 @@ jobs: Copy-Item "./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x64.appx" ` -Destination "./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x64-store.appx" + - name: Deploy to Chocolatey + shell: pwsh + run: | + Copy-Item -Path ./stores/chocolatey -Destination ./dist/chocolatey -Recurse + Copy-Item -Path ./dist/nsis-web/Bitwarden-Installer-${{ env.PACKAGE_VERSION }}.exe -Destination ./dist/chocolatey + + $checksum = checksum -t sha256 ./dist/chocoloatey/Bitwarden-Installer-${{ env.PACKAGE_VERSION }}.exe + $chocoInstall = "./dist/chocolatey/tools/chocolateyinstall.ps1" + (Get-Content $chocoInstall).replace('__version__', "$env:PACKAGE_VERSION").replace('__checksum__', $checksum) | Set-Content $chocoInstall + choco pack ./dist/chocolatey/bitwarden.nuspec --version "$env:PACKAGE_VERSION" --out ./dist/chocolatey + - name: Upload portable exe artifact if: github.ref == 'refs/heads/master' uses: actions/upload-artifact@v2 @@ -212,6 +223,13 @@ jobs: name: Bitwarden-${{ env.PACKAGE_VERSION }}-x64-store.appx path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x64-store.appx + - name: Upload nupkg artifact + if: github.ref == 'refs/heads/master' + uses: actions/upload-artifact@v2 + with: + name: bitwarden.${{ env.PACKAGE_VERSION }}.nupkg + path: ./dist/chocolatey/bitwarden.${{ env.PACKAGE_VERSION }}.nupkg + macos: runs-on: macos-latest steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0e19f9e6c5..b95b4417eb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,7 @@ on: description: 'Release Tag Name (vX.X.X)' required: true + jobs: cloc: runs-on: ubuntu-latest @@ -23,8 +24,36 @@ jobs: - name: Print lines of code run: cloc --include-lang TypeScript,JavaScript,HTML,Sass,CSS --vcs git + + setup: + runs-on: ubuntu-latest + outputs: + release_upload_url: ${{ steps.create_release.outputs.upload_url }} + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Create Release Name + run: | + echo "RELEASE_NAME=${RELEASE_TAG_NAME:1}" >> $GITHUB_ENV + env: + RELEASE_TAG_NAME: ${{ github.event.inputs.release_tag_name }} + + - name: Create Draft Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + with: + tag_name: ${{ github.event.inputs.release_tag_name }} + release_name: ${{ env.RELEASE_NAME }} + draft: true + prerelease: false + + linux: runs-on: ubuntu-latest + needs: setup steps: - name: Set up Node uses: actions/setup-node@v1 @@ -66,38 +95,10 @@ jobs: - name: Run linter run: npm run lint - - name: Build application - run: npm run dist:lin - - - name: Upload .deb artifact - uses: actions/upload-artifact@v2 - with: - name: Bitwarden-${{ env.PACKAGE_VERSION }}-amd64.deb - path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-amd64.deb - - - name: Upload .rpm artifact - uses: actions/upload-artifact@v2 - with: - name: Bitwarden-${{ env.PACKAGE_VERSION }}-x86_64.rpm - path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x86_64.rpm - - - name: Upload .freebsd artifact - uses: actions/upload-artifact@v2 - with: - name: Bitwarden-${{ env.PACKAGE_VERSION }}-x64.freebsd - path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x64.freebsd - - - name: Upload .snap artifact - uses: actions/upload-artifact@v2 - with: - name: bitwarden_${{ env.PACKAGE_VERSION }}_amd64.snap - path: ./dist/bitwarden_${{ env.PACKAGE_VERSION }}_amd64.snap - - - name: Upload .AppImage artifact - uses: actions/upload-artifact@v2 - with: - name: Bitwarden-${{ env.PACKAGE_VERSION }}-x86_64.AppImage - path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x86_64.AppImage + - name: Build & Publish + run: npm run publish:lin + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - name: Deploy to Snap Store run: | @@ -105,8 +106,10 @@ jobs: snapcraft logout shell: pwsh + windows: runs-on: windows-latest + needs: setup steps: - name: Set up dotnet uses: actions/setup-dotnet@v1 @@ -188,54 +191,34 @@ jobs: Copy-Item "./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x64.appx" ` -Destination "./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x64-store.appx" - - name: Upload portable exe artifact - uses: actions/upload-artifact@v2 - with: - name: Bitwarden-Portable-${{ env.PACKAGE_VERSION }}.exe - path: ./dist/Bitwarden-Portable-${{ env.PACKAGE_VERSION }}.exe - - - name: Upload installer exe artifact - uses: actions/upload-artifact@v2 - with: - name: Bitwarden-Installer-${{ env.PACKAGE_VERSION }}.exe - path: ./dist/nsis-web/Bitwarden-Installer-${{ env.PACKAGE_VERSION }}.exe - - - name: Upload store appx ia32 artifact - uses: actions/upload-artifact@v2 - with: - name: Bitwarden-${{ env.PACKAGE_VERSION }}-ia32-store.appx - path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-ia32-store.appx - - - name: Upload store appx x64 artifact - uses: actions/upload-artifact@v2 - with: - name: Bitwarden-${{ env.PACKAGE_VERSION }}-x64-store.appx - path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x64-store.appx - - name: Deploy to Chocolatey - run: ./scripts/choco-update.ps1 -version $env:PACKAGE_VERSION shell: pwsh - - - name: Upload Chocolatey nupkg artifact - uses: actions/upload-artifact@v2 - with: - name: bitwarden.${{ env.PACKAGE_VERSION }}.nupkg - path: ./dist/chocolatey/bitwarden.${{ env.PACKAGE_VERSION }}.nupkg - - - name: Upload release assets run: | - hub release edit ` - -a ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-ia32-store.appx ` - -a ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-x64-store.appx ` - -m "$($env:RELEASE_TAG_NAME.TrimStart('v'))" ` - $env:RELEASE_TAG_NAME - shell: pwsh + Copy-Item -Path ./stores/chocolatey -Destination ./dist/chocolatey -Recurse + Copy-Item -Path ./dist/nsis-web/Bitwarden-Installer-${{ env.PACKAGE_VERSION }}.exe -Destination ./dist/chocolatey + + $checksum = checksum -t sha256 ./dist/chocoloatey/Bitwarden-Installer-${{ env.PACKAGE_VERSION }}.exe + $chocoInstall = "./dist/chocolatey/tools/chocolateyinstall.ps1" + (Get-Content $chocoInstall).replace('__version__', "$env:PACKAGE_VERSION").replace('__checksum__', $checksum) | Set-Content $chocoInstall + choco pack ./dist/chocolatey/bitwarden.nuspec --version "$env:PACKAGE_VERSION" --out ./dist/chocolatey + cd ./dist/chocolatey + choco push + + - name: Upload Chocolatey nupkg release asset + id: upload-macos-checksum + uses: actions/upload-release-asset@v1 env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - RELEASE_TAG_NAME: ${{ github.event.inputs.release_tag_name }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.setup.outputs.release_upload_url }} + asset_name: bitwarden.${{ env.PACKAGE_VERSION }}.nupkg + asset_path: ./dist/chocolatey/bitwarden.${{ env.PACKAGE_VERSION }}.nupkg + asset_content_type: application + macos: runs-on: macos-latest + needs: setup steps: - name: Set up Node uses: actions/setup-node@v1 @@ -318,18 +301,6 @@ jobs: APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }} APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - - name: Upload .zip artifact - uses: actions/upload-artifact@v2 - with: - name: Bitwarden-${{ env.PACKAGE_VERSION }}-mac.zip - path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-mac.zip - - - name: Upload .dmg artifact - uses: actions/upload-artifact@v2 - with: - name: Bitwarden-${{ env.PACKAGE_VERSION }}.dmg - path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}.dmg - - name: Load Safari extension for App Store shell: pwsh run: ./scripts/safari-build.ps1 -mas -copyonly @@ -340,25 +311,38 @@ jobs: APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }} APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - - name: Upload .pkg artifact - uses: actions/upload-artifact@v2 - with: - name: Bitwarden-${{ env.PACKAGE_VERSION }}.pkg - path: ./dist/mas/Bitwarden-${{ env.PACKAGE_VERSION }}.pkg - - name: Deploy to App Store run: npm run upload:mas env: APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }} APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - - name: Upload release assets - run: | - hub release edit ` - -a ./dist/mas/Bitwarden-${{ env.PACKAGE_VERSION }}.pkg ` - -m "$($env:RELEASE_TAG_NAME.TrimStart('v'))" ` - $env:RELEASE_TAG_NAME - shell: pwsh + - name: Upload .pkg release asset + uses: actions/upload-release-asset@v1 env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - RELEASE_TAG_NAME: ${{ github.event.inputs.release_tag_name }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.setup.outputs.release_upload_url }} + asset_name: Bitwarden-${{ env.PACKAGE_VERSION }}.pkg + asset_path: ./dist/mas/Bitwarden-${{ env.PACKAGE_VERSION }}.pkg + asset_content_type: application/vnd.apple.installer+xml + + - name: Upload zip release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.setup.outputs.release_upload_url }} + asset_name: Bitwarden-${{ env.PACKAGE_VERSION }}-mac.zip + asset_path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}-mac.zip + asset_content_type: application/zip + + - name: Upload .dmg release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.setup.outputs.release_upload_url }} + asset_name: Bitwarden-${{ env.PACKAGE_VERSION }}.dmg + asset_path: ./dist/Bitwarden-${{ env.PACKAGE_VERSION }}.dmg + asset_content_type: application/x-apple-diskimage