--- name: Release on: workflow_dispatch: jobs: setup: name: Setup runs-on: ubuntu-20.04 outputs: package_version: ${{ steps.retrieve-version.outputs.package_version }} steps: - name: Branch check run: | if [[ "$GITHUB_REF" != "refs/heads/release" ]]; then echo "===================================" echo "[!] Can only release from the 'release' branch" echo "===================================" exit 1 fi - name: Checkout repo uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 with: ref: release - name: Get Package Version id: retrieve-version run: | PKG_VERSION=$(jq -r .version src/package.json) echo "::set-output name=package_version::$PKG_VERSION" - name: Check to make sure Desktop release version has been bumped env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | latest_ver=$(hub release -L 1 -f '%T') latest_ver=${latest_ver:1} echo "Latest version: $latest_ver" ver=${{ steps.retrieve-version.outputs.package_version }} echo "Version: $ver" if [ "$latest_ver" = "$ver" ]; then echo "Version has not been bumped!" exit 1 fi - name: Download all artifacts uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783 with: workflow: build.yml workflow_conclusion: success branch: release - name: Create release uses: ncipollo/release-action@95215a3cb6e6a1908b3c44e00b4fdb15548b1e09 # v2.8.5 env: PKG_VERSION: ${{ steps.retrieve-version.outputs.package_version }} with: artifacts: "Bitwarden-${{ env.PKG_VERSION }}-amd64.deb, Bitwarden-${{ env.PKG_VERSION }}-x86_64.rpm, Bitwarden-${{ env.PKG_VERSION }}-x64.freebsd, bitwarden_${{ env.PKG_VERSION }}_amd64.snap, Bitwarden-${{ env.PKG_VERSION }}-x86_64.AppImage, latest-linux.yml, Bitwarden-Portable-${{ env.PKG_VERSION }}.exe, Bitwarden-Installer-${{ env.PKG_VERSION }}.exe, Bitwarden-${{ env.PKG_VERSION }}-ia32-store.appx, Bitwarden-${{ env.PKG_VERSION }}-ia32.appx, Bitwarden-${{ env.PKG_VERSION }}-ia32.nsis.7z, Bitwarden-${{ env.PKG_VERSION }}-x64-store.appx, Bitwarden-${{ env.PKG_VERSION }}-x64.appx, Bitwarden-${{ env.PKG_VERSION }}-x64.nsis.7z, Bitwarden-${{ env.PKG_VERSION }}-arm64-store.appx, Bitwarden-${{ env.PKG_VERSION }}-arm64.appx, Bitwarden-${{ env.PKG_VERSION }}-arm64.nsis.7z, bitwarden.${{ env.PKG_VERSION }}.nupkg, latest.yml, Bitwarden-${{ env.PKG_VERSION }}-mac.zip, Bitwarden-${{ env.PKG_VERSION }}.dmg, Bitwarden-${{ env.PKG_VERSION }}.dmg.blockmap, latest-mac.yml, Bitwarden-${{ env.PKG_VERSION }}-universal.pkg" commit: ${{ github.sha }} tag: v${{ env.PKG_VERSION }} name: Version ${{ env.PKG_VERSION }} body: "" token: ${{ secrets.GITHUB_TOKEN }} draft: true snap: name: Deploy Snap runs-on: ubuntu-20.04 needs: setup env: _PKG_VERSION: ${{ needs.setup.outputs.package_version }} steps: - name: Checkout Repo uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 with: ref: release - name: Install Snap uses: samuelmeuli/action-snapcraft@10d7d0a84d9d86098b19f872257df314b0bd8e2d # v1.2.0 with: snapcraft_token: ${{ secrets.SNAP_TOKEN }} - name: Setup run: mkdir dist - name: Download Snap artifact uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783 with: workflow: build.yml workflow_conclusion: success branch: release artifacts: bitwarden_${{ env._PKG_VERSION }}_amd64.snap path: ./dist - name: Test run: ls -alht dist - name: Deploy to Snap Store run: | snapcraft upload dist/bitwarden_${{ env._PKG_VERSION }}_amd64.snap --release stable snapcraft logout choco: name: Deploy Choco runs-on: windows-2019 needs: setup env: _PKG_VERSION: ${{ needs.setup.outputs.package_version }} steps: - name: Checkout Repo uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 with: ref: release - name: Setup Chocolatey run: choco apikey --key $env:CHOCO_API_KEY --source https://push.chocolatey.org/ env: CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }} - name: Make dist dir shell: pwsh run: New-Item -ItemType directory -Path ./dist - name: Download choco artifact uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783 with: workflow: build.yml workflow_conclusion: success branch: release artifacts: bitwarden.${{ env._PKG_VERSION }}.nupkg path: ./dist - name: Push to Chocolatey shell: pwsh run: | cd dist choco push macos: name: Deploy MacOS runs-on: macos-10.15 needs: setup env: _PKG_VERSION: ${{ needs.setup.outputs.package_version }} steps: - name: Checkout repo uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 with: ref: release - name: Make target directory run: mkdir -p dist/mas-universal - name: Download Mac artifact uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783 with: workflow: build.yml workflow_conclusion: success branch: release artifacts: Bitwarden-${{ env._PKG_VERSION }}-universal.pkg path: ./dist/mas-universal - 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 }}