chore: deprecate web v2; release web 2.15.0 #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build old version of web app and deploy it | |
name: web-old | |
on: | |
push: | |
branches: ['v2'] | |
pull_request: | |
repository_dispatch: | |
types: build | |
workflow_dispatch: | |
workflow_call: | |
concurrency: | |
group: web-${{ github.workflow }}-${{ github.ref_type }}-${{ github.event.pull_request.number || github.ref || github.run_id }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -euxo pipefail {0} | |
env: | |
GITHUB_REPOSITORY_URL: ${{ github.server_url }}/${{ github.repository }} | |
VERBOSE: 1 | |
jobs: | |
build-web: | |
name: "Build Web" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: "Setup environment (v2)" | |
if: endsWith(github.ref, '/v2') | |
run: | | |
echo "ENV_NAME=v2" >> $GITHUB_ENV | |
echo "FULL_DOMAIN=https://v2.clades.nextstrain.org" >> $GITHUB_ENV | |
echo "DATA_FULL_DOMAIN=https://data.clades.nextstrain.org" >> $GITHUB_ENV | |
echo "PLAUSIBLE_IO_DOMAIN=v2.clades.nextstrain.org" >> $GITHUB_ENV | |
- name: "Checkout code" | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
submodules: true | |
- name: "Get docker build checksum" | |
id: docker-build-checksum | |
run: echo "checksum=$(./scripts/docker_build_checksum.sh)" >> $GITHUB_OUTPUT | |
- name: "Setup cache for Docker buildx" | |
uses: actions/cache@v3 | |
with: | |
path: .cache/docker/buildx | |
key: cache-v1-buildx-${{ runner.os }}-wasm32-unknown-unknown-${{ steps.docker-build-checksum.outputs.checksum }} | |
restore-keys: | | |
cache-v1-buildx-${{ runner.os }}-wasm32-unknown-unknown-${{ steps.docker-build-checksum.outputs.checksum }} | |
cache-v1-buildx-${{ runner.os }}-wasm32-unknown-unknown- | |
cache-v1-buildx-${{ runner.os }}-${{ steps.docker-build-checksum.outputs.checksum }} | |
cache-v1-buildx-${{ runner.os }}- | |
- name: "Setup cache for Rust and Cargo" | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.build/ | |
.cache/docker/.cargo | |
packages_rs/nextclade-web/.build/docker | |
key: cache-v1-cargo-${{ runner.os }}-wasm32-unknown-unknown-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
cache-v1-cargo-${{ runner.os }}-wasm32-unknown-unknown-${{ hashFiles('**/Cargo.lock') }} | |
cache-v1-cargo-${{ runner.os }}-wasm32-unknown-unknown- | |
cache-v1-cargo-${{ runner.os }}- | |
- name: "Setup cache for web app" | |
uses: actions/cache@v3 | |
with: | |
path: | | |
packages_rs/nextclade-web/.build/production/tmp/cache | |
packages_rs/nextclade-web/.cache | |
packages_rs/nextclade-web/node_modules | |
key: cache-v1-web-${{ runner.os }}-wasm32-unknown-unknown-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
cache-v1-web-${{ runner.os }}-wasm32-unknown-unknown-${{ hashFiles('**/yarn.lock') }} | |
cache-v1-web-${{ runner.os }}-wasm32-unknown-unknown- | |
cache-v1-web-${{ runner.os }}- | |
- name: "Prepare .env file" | |
run: | | |
cp .env.example .env | |
sed -i -e "s|FULL_DOMAIN=autodetect|FULL_DOMAIN=${FULL_DOMAIN}|g" .env | |
sed -i -e "s|DATA_FULL_DOMAIN=https://data.master.clades.nextstrain.org|DATA_FULL_DOMAIN=${DATA_FULL_DOMAIN}|g" .env | |
- name: "Login to Docker Hub" | |
uses: docker/login-action@v2 | |
with: | |
registry: docker.io | |
username: nextstrainbot | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: "Build docker image" | |
run: | | |
CROSS="wasm32-unknown-unknown" ./docker-dev docker-image-build-push | |
- name: "Install Node.js packages" | |
run: | | |
./docker-dev web yarn install | |
- name: "Build WebAssembly module" | |
run: | | |
./docker-dev wasm-release | |
- name: "Build web app" | |
run: | | |
./docker-dev web-release | |
- name: "Lint web app code" | |
run: | | |
./docker-dev web yarn lint:ci | |
- name: "Lint Rust code" | |
run: | | |
./docker-dev lint-ci | |
- name: "Upload build artifacts" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: out | |
path: "packages_rs/nextclade-web/.build/production/web" | |
deploy-web: | |
name: "Deploy Web" | |
if: ${{ endsWith(github.ref, '/v2') }} | |
needs: [ build-web ] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: "Setup environment" | |
run: | | |
echo "AWS_ACCESS_KEY_ID=${{ secrets.V2_AWS_ACCESS_KEY_ID }}" >> $GITHUB_ENV | |
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.V2_AWS_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV | |
echo "AWS_CLOUDFRONT_DISTRIBUTION_ID=${{ secrets.V2_AWS_CLOUDFRONT_DISTRIBUTION_ID }}" >> $GITHUB_ENV | |
echo "AWS_DEFAULT_REGION=${{ secrets.V2_AWS_DEFAULT_REGION }}" >> $GITHUB_ENV | |
echo "AWS_S3_BUCKET=${{ secrets.V2_AWS_S3_BUCKET }}" >> $GITHUB_ENV | |
- name: "Checkout code" | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
submodules: true | |
- name: "Download build artifacts" | |
uses: actions/download-artifact@v3 | |
with: | |
name: "out" | |
path: "packages_rs/nextclade-web/.build/production/web" | |
- name: "Install deploy dependencies" | |
run: | | |
mkdir -p "${HOME}/bin" | |
curl -fsSL "https://github.com/cli/cli/releases/download/v2.10.1/gh_2.10.1_linux_amd64.tar.gz" | tar xz -C "${HOME}/bin" --strip-components=2 gh_2.10.1_linux_amd64/bin/gh | |
sudo apt-get install brotli pigz parallel rename --yes -qq >/dev/null | |
pushd /tmp >/dev/null | |
curl -fsSL "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
unzip -oqq awscliv2.zip | |
sudo ./aws/install --update | |
popd >/dev/null | |
aws --version | |
- name: "Deploy web app" | |
run: | | |
./scripts/deploy_web.sh | |
- name: "Create and push git tag" | |
if: ${{ endsWith(github.ref, '/v2') }} | |
run: | | |
git config user.email "${{ secrets.GIT_USER_EMAIL }}" | |
git config user.name "${{ secrets.GIT_USER_NAME }}" | |
pushd packages_rs/nextclade-web >/dev/null | |
export version=$(node -e "\ | |
const pkg = require('./package.json'); \ | |
console.log(pkg.version) \ | |
") | |
popd >/dev/null | |
git tag "web-${version}" | |
git push origin "web-${version}" |