浏览代码

Add deploy actions

pull/480/head
Guillaume Vincent 5 年前
父节点
当前提交
99b0bdbb6f
共有 10 个文件被更改,包括 102 次插入32 次删除
  1. +52
    -0
      .github/workflows/deploy.yml
  2. +18
    -9
      .github/workflows/test.yml
  3. +1
    -1
      README.md
  4. +1
    -1
      bin/tag
  5. +11
    -13
      containers/deploy
  6. +1
    -0
      containers/frontend
  7. +2
    -3
      containers/test
  8. +0
    -4
      netlify.toml
  9. +15
    -0
      packages/deploy
  10. +1
    -1
      packages/lesspass-site/package.json

+ 52
- 0
.github/workflows/deploy.yml 查看文件

@@ -0,0 +1,52 @@
name: deploy

on:
push:
branches:
- refs/tags/*

jobs:
deploy-containers:
runs-on: ubuntu-latest
needs: test-containers
steps:
- uses: actions/checkout@v1
- name: deploy containers
run: |
cd containers
./deploy
env:
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}

deploy-packages:
runs-on: ubuntu-latest
needs: test-packages
steps:
- uses: actions/checkout@v1
- name: deploy packages
run: |
cd packages
./deploy
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

deploy-cli:
runs-on: ubuntu-latest
needs: test-cli
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: deploy cli
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
cd cli
python -m pip install --upgrade pip
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
twine upload dist/*

.github/workflows/main.yml → .github/workflows/test.yml 查看文件

@@ -1,28 +1,28 @@
name: ci
name: test

on: [push, pull_request]

jobs:
test-javascript-packages:
test-packages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: test javascript packages
- name: test packages
run: |
yarn install
yarn test

test-mobile-app:
test-mobile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: test mobile app
- name: test mobile
run: |
cd mobile
yarn install
yarn test

test-python-cli:
test-cli:
runs-on: ubuntu-latest
strategy:
max-parallel: 3
@@ -33,7 +33,7 @@ jobs:
- uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: test python cli
- name: test cli
run: |
cd cli
python -m pip install --upgrade pip
@@ -42,16 +42,25 @@ jobs:
export PYTHONPATH='.'
python -m unittest discover

test-python-backend:
test-backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: "3.6"
- name: test python backend
- name: test backend
run: |
cd containers/backend
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python manage.py test

test-containers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: test containers
run: |
cd containers
./test

+ 1
- 1
README.md 查看文件

@@ -1,4 +1,4 @@
[![Actions Status](https://github.com/lesspass/lesspass/workflows/ci/badge.svg)](https://github.com/lesspass/lesspass/actions) [![Backers on Open Collective](https://opencollective.com/lesspass/backers/badge.svg)](CONTRIBUTING.md#backers) [![Sponsors on Open Collective](https://opencollective.com/lesspass/sponsors/badge.svg)](CONTRIBUTING.md#sponsors)
[![Actions Status](https://github.com/lesspass/lesspass/workflows/test/badge.svg)](https://github.com/lesspass/lesspass/actions) [![Backers on Open Collective](https://opencollective.com/lesspass/backers/badge.svg)](CONTRIBUTING.md#backers) [![Sponsors on Open Collective](https://opencollective.com/lesspass/sponsors/badge.svg)](CONTRIBUTING.md#sponsors)

# LessPass



+ 1
- 1
bin/tag 查看文件

@@ -56,10 +56,10 @@ function replace_versions_in_files {
sed -i "s/\"version\": \"${1}\"/\"version\": \"${2}\"/g" packages/lesspass-pure/package.json
sed -i "s/\"lesspass\": \"${1}\"/\"lesspass\": \"${2}\"/g" packages/lesspass-pure/package.json
sed -i "s/\"version\": \"${1}\"/\"version\": \"${2}\"/g" packages/lesspass-render-password/package.json
sed -i "s/\"version\": \"${1}\"/\"version\": \"${2}\"/g" packages/lesspass-site/package.json
sed -i "s/\"version\": \"${1}\"/\"version\": \"${2}\"/g" packages/lesspass-web-extension/package.json
sed -i "s/\"lesspass-pure\": \"${1}\"/\"lesspass-pure\": \"${2}\"/g" packages/lesspass-web-extension/package.json
sed -i "s/\"version\": \"${1}\"/\"version\": \"${2}\"/g" packages/lesspass-web-extension/extension/manifest.json
sed -i "s/\"version\": \"${1}\"/\"version\": \"${2}\"/g" containers/frontend/package.json
sed -i "s/VERSION=\"${1}\"/VERSION=\"${2}\"/g" containers/deploy
}



+ 11
- 13
containers/deploy 查看文件

@@ -1,16 +1,14 @@
#!/usr/bin/env bash
set -e

VERSION="9.0.0"
podman login --username "${QUAI_USERNAME}" --password "${QUAI_PASSWORD}" quai.io
podman build --tag lesspass/webserver:${VERSION} --tag lesspass/webserver:latest ./webserver
podman build --tag lesspass/frontend:${VERSION} --tag lesspass/frontend:latest ./frontend
podman build --tag lesspass/backend:${VERSION} --tag lesspass/backend:latest ./backend
podman images
podman --version
podman push --creds "${QUAI_USERNAME}:${QUAI_PASSWORD}" lesspass/webserver:${VERSION} docker://quai.io/lesspass/webserver
podman push --creds "${QUAI_USERNAME}:${QUAI_PASSWORD}" lesspass/webserver:latest docker://quai.io/lesspass/webserver
podman push --creds "${QUAI_USERNAME}:${QUAI_PASSWORD}" lesspass/frontend:${VERSION} docker://quai.io/lesspass/frontend
podman push --creds "${QUAI_USERNAME}:${QUAI_PASSWORD}" lesspass/frontend:latest docker://quai.io/lesspass/frontend
podman push --creds "${QUAI_USERNAME}:${QUAI_PASSWORD}" lesspass/backend:${VERSION} docker://quai.io/lesspass/backend
podman push --creds "${QUAI_USERNAME}:${QUAI_PASSWORD}" lesspass/backend:latest docker://quai.io/lesspass/backend
build_and_push () {
PROJECT=$1
docker build --tag lesspass/${PROJECT} ./${PROJECT}
docker tag lesspass/${PROJECT} quay.io/lesspass/${PROJECT}
docker push quay.io/lesspass/${PROJECT}
}

docker login --username="${QUAY_USERNAME}" --password="${QUAY_PASSWORD}" quay.io
build_and_push webserver
build_and_push backend
build_and_push frontend

+ 1
- 0
containers/frontend 查看文件

@@ -0,0 +1 @@
../packages/lesspass-site/

+ 2
- 3
containers/test 查看文件

@@ -1,11 +1,10 @@
#!/usr/bin/env bash
set -e

# containers
export COMPOSE_PROJECT_NAME=lesspass
docker-compose build
docker-compose down -v
docker-compose up -d
docker exec -it lesspass_backend_1 sh -c 'python wait_db.py'
docker exec -it lesspass_backend_1 sh -c 'python manage.py test'
docker exec lesspass_backend_1 sh -c 'python wait_db.py'
docker exec lesspass_backend_1 sh -c 'python manage.py test'
docker-compose down -v

+ 0
- 4
netlify.toml 查看文件

@@ -1,4 +0,0 @@
[build]
base = "packages/lesspass-site/"
publish = "packages/lesspass-site/build/"
command = "yarn build"

+ 15
- 0
packages/deploy 查看文件

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -e

install_and_publish () {
PROJECT=$1
pushd ${PROJECT}
yarn publish
popd
}

projects="lesspass lesspass-crypto lesspass-entropy lesspass-fingerprint lesspass-pure lesspass-render-password"
for project in ${projects}
do
install_and_publish ${project}
done

+ 1
- 1
packages/lesspass-site/package.json 查看文件

@@ -1,5 +1,5 @@
{
"name": "lesspass-web-site",
"name": "lesspass-site",
"version": "9.0.0",
"description": "LessPass web site",
"license": "GPL-3.0",


正在加载...
取消
保存