2021-09-02 22:04:41 +02:00
|
|
|
---
|
2021-07-27 19:25:12 +02:00
|
|
|
name: Release
|
2022-11-08 21:27:22 +01:00
|
|
|
run-name: Release ${{ inputs.release_type }}
|
2021-07-27 19:25:12 +02:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2021-12-20 21:19:46 +01:00
|
|
|
inputs:
|
|
|
|
release_type:
|
|
|
|
description: 'Release Options'
|
|
|
|
required: true
|
|
|
|
default: 'Initial Release'
|
|
|
|
type: choice
|
|
|
|
options:
|
|
|
|
- Initial Release
|
|
|
|
- Redeploy
|
2022-03-10 19:31:49 +01:00
|
|
|
- Dry Run
|
2022-07-15 15:30:14 +02:00
|
|
|
fdroid_publish:
|
|
|
|
description: 'Publish to f-droid store'
|
|
|
|
required: true
|
|
|
|
default: true
|
|
|
|
type: boolean
|
2021-07-27 19:25:12 +02:00
|
|
|
|
|
|
|
jobs:
|
2021-09-24 19:50:54 +02:00
|
|
|
release:
|
|
|
|
name: Create Release
|
|
|
|
runs-on: ubuntu-20.04
|
2021-11-08 15:48:40 +01:00
|
|
|
outputs:
|
|
|
|
branch-name: ${{ steps.branch.outputs.branch-name }}
|
2021-09-24 19:50:54 +02:00
|
|
|
steps:
|
2021-10-22 18:24:48 +02:00
|
|
|
- name: Branch check
|
2022-03-10 19:31:49 +01:00
|
|
|
if: github.event.inputs.release_type != 'Dry Run'
|
2021-10-22 18:24:48 +02:00
|
|
|
run: |
|
2022-03-09 21:46:24 +01:00
|
|
|
if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then
|
2021-10-22 18:24:48 +02:00
|
|
|
echo "==================================="
|
2022-03-09 21:46:24 +01:00
|
|
|
echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches"
|
2021-10-22 18:24:48 +02:00
|
|
|
echo "==================================="
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-09-24 19:50:54 +02:00
|
|
|
- name: Checkout repo
|
2022-02-23 15:48:07 +01:00
|
|
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
|
2021-09-24 19:50:54 +02:00
|
|
|
|
2022-06-13 21:58:19 +02:00
|
|
|
- name: Check Release Version
|
|
|
|
id: version
|
|
|
|
uses: bitwarden/gh-actions/release-version-check@8f055ef543c7433c967a1b9b04a0f230923233bb
|
|
|
|
with:
|
|
|
|
release-type: ${{ github.event.inputs.release_type }}
|
|
|
|
project-type: xamarin
|
|
|
|
file: src/Android/Properties/AndroidManifest.xml
|
2021-09-24 19:50:54 +02:00
|
|
|
|
2021-11-08 15:48:40 +01:00
|
|
|
- name: Get branch name
|
|
|
|
id: branch
|
|
|
|
run: |
|
|
|
|
BRANCH_NAME=$(basename ${{ github.ref }})
|
|
|
|
echo "::set-output name=branch-name::$BRANCH_NAME"
|
|
|
|
|
2022-08-04 19:47:49 +02:00
|
|
|
- name: Create GitHub deployment
|
|
|
|
uses: chrnorm/deployment-action@1b599fe41a0ef1f95191e7f2eec4743f2d7dfc48
|
|
|
|
id: deployment
|
|
|
|
with:
|
|
|
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
|
|
initial-status: 'in_progress'
|
|
|
|
environment: 'production'
|
|
|
|
description: 'Deployment ${{ steps.version.outputs.version }} from branch ${{ steps.branch.outputs.branch-name }}'
|
|
|
|
task: release
|
|
|
|
|
|
|
|
|
2021-09-24 19:50:54 +02:00
|
|
|
- name: Download all artifacts
|
2022-07-19 21:01:03 +02:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
2022-02-23 15:48:07 +01:00
|
|
|
uses: dawidd6/action-download-artifact@575b1e4167df67acf7e692af784566618b23c71e # v2.17.10
|
2021-09-24 19:50:54 +02:00
|
|
|
with:
|
|
|
|
workflow: build.yml
|
|
|
|
workflow_conclusion: success
|
2021-11-08 15:48:40 +01:00
|
|
|
branch: ${{ steps.branch.outputs.branch-name }}
|
2021-09-24 19:50:54 +02:00
|
|
|
|
2022-11-08 23:44:50 +01:00
|
|
|
- name: Dry Run - Download all artifacts
|
2022-07-19 21:01:03 +02:00
|
|
|
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
|
|
|
|
uses: dawidd6/action-download-artifact@575b1e4167df67acf7e692af784566618b23c71e # v2.17.10
|
|
|
|
with:
|
|
|
|
workflow: build.yml
|
|
|
|
workflow_conclusion: success
|
|
|
|
branch: master
|
|
|
|
|
2022-02-15 16:57:21 +01:00
|
|
|
- name: Prep Bitwarden iOS release asset
|
|
|
|
run: zip -r Bitwarden\ iOS.zip Bitwarden\ iOS
|
|
|
|
|
2021-09-24 19:50:54 +02:00
|
|
|
- name: Create release
|
2022-07-19 21:01:03 +02:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
2022-02-23 15:48:07 +01:00
|
|
|
uses: ncipollo/release-action@40bb172bd05f266cf9ba4ff965cb61e9ee5f6d01 # v1.9.0
|
2021-09-24 19:50:54 +02:00
|
|
|
with:
|
|
|
|
artifacts: "./com.x8bit.bitwarden.aab/com.x8bit.bitwarden.aab,
|
|
|
|
./com.x8bit.bitwarden.apk/com.x8bit.bitwarden.apk,
|
|
|
|
./com.x8bit.bitwarden-fdroid.apk/com.x8bit.bitwarden-fdroid.apk,
|
2022-02-15 16:57:21 +01:00
|
|
|
./Bitwarden iOS.zip"
|
2021-09-24 19:50:54 +02:00
|
|
|
commit: ${{ github.sha }}
|
2022-06-13 21:58:19 +02:00
|
|
|
tag: v${{ steps.version.outputs.version }}
|
|
|
|
name: Version ${{ steps.version.outputs.version }}
|
2021-09-24 19:50:54 +02:00
|
|
|
body: "<insert release notes here>"
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
draft: true
|
2021-07-27 19:25:12 +02:00
|
|
|
|
2022-08-04 19:47:49 +02:00
|
|
|
- name: Update deployment status to Success
|
|
|
|
if: ${{ success() }}
|
|
|
|
uses: chrnorm/deployment-status@07b3930847f65e71c9c6802ff5a402f6dfb46b86
|
|
|
|
with:
|
|
|
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
|
|
state: 'success'
|
|
|
|
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|
|
|
|
|
|
|
|
- name: Update deployment status to Failure
|
|
|
|
if: ${{ failure() }}
|
|
|
|
uses: chrnorm/deployment-status@07b3930847f65e71c9c6802ff5a402f6dfb46b86
|
|
|
|
with:
|
|
|
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
|
|
state: 'failure'
|
|
|
|
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|
|
|
|
|
2021-07-27 19:25:12 +02:00
|
|
|
|
2021-09-24 19:50:54 +02:00
|
|
|
f-droid:
|
|
|
|
name: F-Droid Release
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
needs: release
|
2022-07-15 15:30:14 +02:00
|
|
|
if: inputs.fdroid_publish
|
2021-07-27 19:25:12 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2022-02-23 15:48:07 +01:00
|
|
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
|
2021-09-24 19:50:54 +02:00
|
|
|
|
|
|
|
- name: Download F-Droid .apk artifact
|
2022-07-19 21:01:03 +02:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
2022-02-23 15:48:07 +01:00
|
|
|
uses: dawidd6/action-download-artifact@575b1e4167df67acf7e692af784566618b23c71e # v2.17.10
|
2021-09-24 19:50:54 +02:00
|
|
|
with:
|
|
|
|
workflow: build.yml
|
|
|
|
workflow_conclusion: success
|
2021-11-08 15:48:40 +01:00
|
|
|
branch: ${{ needs.release.outputs.branch-name }}
|
2021-09-24 19:50:54 +02:00
|
|
|
name: com.x8bit.bitwarden-fdroid.apk
|
|
|
|
|
2022-11-08 23:44:50 +01:00
|
|
|
- name: Dry Run - Download F-Droid .apk artifact
|
2022-07-19 21:01:03 +02:00
|
|
|
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
|
|
|
|
uses: dawidd6/action-download-artifact@575b1e4167df67acf7e692af784566618b23c71e # v2.17.10
|
|
|
|
with:
|
|
|
|
workflow: build.yml
|
|
|
|
workflow_conclusion: success
|
|
|
|
branch: master
|
|
|
|
name: com.x8bit.bitwarden-fdroid.apk
|
|
|
|
|
2021-09-24 19:50:54 +02:00
|
|
|
- name: Set up Node
|
2022-02-23 15:48:07 +01:00
|
|
|
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # v2.5.1
|
2021-09-24 19:50:54 +02:00
|
|
|
with:
|
|
|
|
node-version: '10.x'
|
|
|
|
|
|
|
|
- name: Set up F-Droid server
|
|
|
|
run: |
|
|
|
|
sudo apt-get -qq update
|
|
|
|
sudo apt-get -qqy install --no-install-recommends fdroidserver wget
|
|
|
|
|
|
|
|
- name: Set up Git credentials
|
|
|
|
env:
|
|
|
|
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
|
|
|
run: |
|
|
|
|
git config --global credential.helper store
|
|
|
|
echo "https://${ACCESS_TOKEN}:x-oauth-basic@github.com" >> ~/.git-credentials
|
|
|
|
git config --global user.email "ci@bitwarden.com"
|
|
|
|
git config --global user.name "Bitwarden CI"
|
|
|
|
|
|
|
|
- name: Print environment
|
|
|
|
run: |
|
|
|
|
node --version
|
|
|
|
npm --version
|
|
|
|
git --version
|
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
|
|
|
|
|
|
|
- name: Install Node dependencies
|
|
|
|
run: npm install
|
|
|
|
|
|
|
|
- name: Decrypt secrets
|
|
|
|
env:
|
|
|
|
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
|
|
|
run: |
|
|
|
|
mkdir -p ~/secrets
|
|
|
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
|
|
|
--output ./store/fdroid/keystore.jks ./.github/secrets/store_fdroid-keystore.jks.gpg
|
2021-07-27 19:25:12 +02:00
|
|
|
|
2021-09-24 19:50:54 +02:00
|
|
|
- name: Compile for F-Droid Store
|
|
|
|
env:
|
|
|
|
FDROID_STORE_KEYSTORE_PASSWORD: ${{ secrets.FDROID_STORE_KEYSTORE_PASSWORD }}
|
2021-07-27 19:25:12 +02:00
|
|
|
run: |
|
2021-09-24 19:50:54 +02:00
|
|
|
cd $GITHUB_WORKSPACE
|
|
|
|
mkdir dist
|
|
|
|
cp CNAME ./dist
|
|
|
|
cd store
|
|
|
|
chmod 600 fdroid/config.py fdroid/keystore.jks
|
|
|
|
mkdir -p temp/fdroid
|
|
|
|
TEMP_DIR="$GITHUB_WORKSPACE/store/temp/fdroid"
|
|
|
|
cd fdroid
|
|
|
|
echo "keypass=\"$FDROID_STORE_KEYSTORE_PASSWORD\"" >>config.py
|
|
|
|
echo "keystorepass=\"$FDROID_STORE_KEYSTORE_PASSWORD\"" >>config.py
|
|
|
|
echo "local_copy_dir=\"$TEMP_DIR\"" >>config.py
|
|
|
|
mkdir -p repo
|
|
|
|
mv $GITHUB_WORKSPACE/com.x8bit.bitwarden-fdroid.apk ./repo/
|
|
|
|
fdroid update
|
|
|
|
fdroid server update
|
|
|
|
cd ..
|
|
|
|
rm -rf temp/fdroid/archive
|
|
|
|
mv -v temp/fdroid ../dist
|
|
|
|
cd fdroid
|
|
|
|
cp index.html btn.png qr.png ../../dist/fdroid
|
|
|
|
cd $GITHUB_WORKSPACE
|
2021-07-27 19:25:12 +02:00
|
|
|
|
2021-09-24 19:50:54 +02:00
|
|
|
- name: Deploy to gh-pages
|
2022-07-19 21:01:03 +02:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
2021-09-24 19:50:54 +02:00
|
|
|
run: npm run deploy
|