Release Build + Versioning (#373)
- Adds version to version.txt in root - adds update-version.sh which updates version in frontend/package.json and backend/btrixcloud/version.py - frontend: loads version from $VERSION env var, ../version.txt or package.json - ci: on new github release, pushes webrecorder/browsertrix-backend and webrecorder/browsertrix-frontend images to Dockerhub with current version, as well as latest. - version set to 1.1.0-beta.0 - closes #357
This commit is contained in:
parent
704838f562
commit
d6386b7051
58
.github/workflows/release.yaml
vendored
Normal file
58
.github/workflows/release.yaml
vendored
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
name: Browsertrix Cloud Release Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
btrix-release:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Set Env Vars
|
||||||
|
run: |
|
||||||
|
echo VERSION=`cat version.txt` >> $GITHUB_ENV
|
||||||
|
echo GIT_COMMIT_HASH=`git rev-parse --short HEAD` >> $GITHUB_ENV
|
||||||
|
echo GIT_BRANCH_NAME=`git rev-parse --abbrev-ref HEAD` >> $GITHUB_ENV
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Build Backend
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: backend
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.REPO_PREFIX }}webrecorder/browsertrix-backend:${{ env.VERSION }}, webrecorder/browsertrix-backend:latest
|
||||||
|
cache-from: type=gha,scope=backend
|
||||||
|
cache-to: type=gha,scope=backend,mode=max
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Build Frontend
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: frontend
|
||||||
|
push: true
|
||||||
|
build-args: |
|
||||||
|
VERSION=${{ env.VERSION }}
|
||||||
|
GIT_COMMIT_HASH=${{ env.GIT_COMMIT_HASH }}
|
||||||
|
GIT_BRANCH_NAME=${{ env.GIT_BRANCH_NAME }}
|
||||||
|
|
||||||
|
tags: ${{ env.REPO_PREFIX }}webrecorder/browsertrix-frontend:${{ env.VERSION }}, webrecorder/browsertrix-frontend:latest
|
||||||
|
cache-from: type=gha,scope=frontend
|
||||||
|
cache-to: type=gha,scope=frontend,mode=max
|
||||||
|
|
2
backend/btrixcloud/version.py
Normal file
2
backend/btrixcloud/version.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
""" current version """
|
||||||
|
__version__ = "1.1.0-beta.0"
|
@ -1,13 +1,15 @@
|
|||||||
# central place to configure the production replayweb.page loading prefix
|
# central place to configure the production replayweb.page loading prefix
|
||||||
ARG RWP_BASE_URL=https://cdn.jsdelivr.net/npm/replaywebpage@1.5.8/
|
ARG RWP_BASE_URL=https://cdn.jsdelivr.net/npm/replaywebpage/
|
||||||
|
|
||||||
FROM node:16 as build
|
FROM node:16 as build
|
||||||
|
|
||||||
ARG GIT_COMMIT_HASH
|
ARG GIT_COMMIT_HASH
|
||||||
ARG GIT_BRANCH_NAME
|
ARG GIT_BRANCH_NAME
|
||||||
|
ARG VERSION
|
||||||
|
|
||||||
ENV GIT_COMMIT_HASH=${GIT_COMMIT_HASH} \
|
ENV GIT_COMMIT_HASH=${GIT_COMMIT_HASH} \
|
||||||
GIT_BRANCH_NAME=${GIT_BRANCH_NAME}
|
GIT_BRANCH_NAME=${GIT_BRANCH_NAME} \
|
||||||
|
VERSION=${VERSION}
|
||||||
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "frontend",
|
"name": "browsertrix-frontend",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0-beta.0",
|
||||||
"main": "index.ts",
|
"main": "index.ts",
|
||||||
"license": "MIT",
|
"license": "AGPLv3",
|
||||||
"private": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cheap-glitch/mi-cron": "^1.0.1",
|
"@cheap-glitch/mi-cron": "^1.0.1",
|
||||||
"@formatjs/intl-displaynames": "^5.2.5",
|
"@formatjs/intl-displaynames": "^5.2.5",
|
||||||
|
@ -6,6 +6,7 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|||||||
const CopyPlugin = require("copy-webpack-plugin");
|
const CopyPlugin = require("copy-webpack-plugin");
|
||||||
const childProcess = require("child_process");
|
const childProcess = require("child_process");
|
||||||
const packageJSON = require("./package.json");
|
const packageJSON = require("./package.json");
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
const isDevServer = process.env.WEBPACK_SERVE;
|
const isDevServer = process.env.WEBPACK_SERVE;
|
||||||
|
|
||||||
@ -51,6 +52,18 @@ const shoelaceAssetsSrcPath = path.resolve(
|
|||||||
);
|
);
|
||||||
const shoelaceAssetsPublicPath = "shoelace/assets";
|
const shoelaceAssetsPublicPath = "shoelace/assets";
|
||||||
|
|
||||||
|
const version = (() => {
|
||||||
|
if (process.env.VERSION) {
|
||||||
|
return process.env.VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return fs.readFileSync("../version.txt", {encoding: "utf-8"}).trim();
|
||||||
|
} catch(e) {}
|
||||||
|
|
||||||
|
return packageJSON.version;
|
||||||
|
})();
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: "./src/index.ts",
|
entry: "./src/index.ts",
|
||||||
output: {
|
output: {
|
||||||
@ -102,7 +115,7 @@ module.exports = {
|
|||||||
rwp_base_url: RWP_BASE_URL,
|
rwp_base_url: RWP_BASE_URL,
|
||||||
glitchtip_dsn: process.env.GLITCHTIP_DSN || "",
|
glitchtip_dsn: process.env.GLITCHTIP_DSN || "",
|
||||||
environment: isDevServer ? "development" : "production",
|
environment: isDevServer ? "development" : "production",
|
||||||
version: packageJSON.version,
|
version,
|
||||||
gitBranch,
|
gitBranch,
|
||||||
commitHash,
|
commitHash,
|
||||||
},
|
},
|
||||||
|
8
update-version.sh
Executable file
8
update-version.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
version=`cat version.txt`
|
||||||
|
jq ".version=\"$version\"" ./frontend/package.json > ./tmp-package.json
|
||||||
|
mv ./tmp-package.json ./frontend/package.json
|
||||||
|
|
||||||
|
echo '""" current version """' > ./backend/btrixcloud/version.py
|
||||||
|
echo "__version__ = \"$version\"" >> ./backend/btrixcloud/version.py
|
1
version.txt
Normal file
1
version.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
1.1.0-beta.0
|
Loading…
Reference in New Issue
Block a user