diff --git a/.gitlab-ci.yml b/..gitlab-ci.yml similarity index 100% rename from .gitlab-ci.yml rename to ..gitlab-ci.yml diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000..bf7c41c --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,77 @@ +name: Nightly + +on: + workflow_dispatch: + +jobs: + image: + name: Publish Image + environment: Development + runs-on: Ubuntu-20.04 + env: + APPLICATION: cut + strategy: + matrix: + service: [be, fe] + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Setup QEMU + uses: docker/setup-qemu-action@v1 + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: Set Development Version + run: echo "RELEASE_VERSION=v0.0.0-development" >> $GITHUB_ENV + - name: Provide Env File + run: | + echo "${{ secrets.FE_ENV_FILE }}" > ${{ env.APPLICATION }}-${{ matrix.service }}/.env.production + echo "VUE_APP_VERSION=${{ env.RELEASE_VERSION }}" >> ${{ env.APPLICATION }}-${{ matrix.service }}/.env.production + - name: Build and Push Image + uses: docker/build-push-action@v2 + with: + context: ${{ env.APPLICATION }}-${{ matrix.service }} + platforms: linux/amd64 + tags: daystram/${{ env.APPLICATION }}:${{ matrix.service }}-dev + push: true + chart: + name: Publish Helm Chart + environment: Development + runs-on: Ubuntu-20.04 + container: daystram/k8s-tools:latest + needs: [image] + env: + APPLICATION: cut + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Set Development Version + run: echo "RELEASE_VERSION=v0.0.0-development" >> $GITHUB_ENV + - name: Initialize Git Credentials + run: | + git config --global user.name "${{ secrets.BOTDAYSTRAM_NAME }}" + git config --global user.email "${{ secrets.BOTDAYSTRAM_EMAIL }}" + mkdir -p /root/.ssh && echo "${{ secrets.BOTDAYSTRAM_KEY_FILE }}" > /root/.ssh/id_rsa.github && chmod 600 /root/.ssh/id_rsa.github + cat >> /etc/ssh/ssh_config < $KUBECONFIG && chmod 700 $KUBECONFIG + - name: Build and Deploy Chart + run: | + eval `ssh-agent -s` + git clone ssh://git@github.com/daystram/helm-charts.git + cp -r .daystram helm-charts/docs/ + cd helm-charts/docs/ + curl -sfL https://charts.daystram.com/build.sh | sh -s - ${{ env.APPLICATION }} ${{ env.RELEASE_VERSION }} + rm -rf .daystram/ + git add . + git commit -m "feat: added chart for ${{ env.APPLICATION }}@${{ env.RELEASE_VERSION }}" + git push diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..717baab --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,67 @@ +name: Build +on: push +jobs: + build-be: + name: Build cut-be + runs-on: Ubuntu-20.04 + defaults: + run: + working-directory: cut-be + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Setup Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Build + uses: actions-rs/cargo@v1 + with: + command: build + args: --release --all-features --manifest-path cut-be/Cargo.toml + - name: Archive Artifacts + uses: actions/upload-artifact@v2 + with: + name: build-be + path: | + cut-be/target/release/cut-be + lint-fe: + name: Lint cut-fe + runs-on: ubuntu-latest + defaults: + run: + working-directory: cut-fe + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Setup Node.js + uses: actions/setup-node@v2.1.5 + with: + node-version: 12.x + - name: Install Dependencies + run: yarn install + - name: eslint + run: yarn lint + build-fe: + name: Build cut-fe + runs-on: Ubuntu-20.04 + defaults: + run: + working-directory: cut-fe + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Setup Node.js + uses: actions/setup-node@v2.1.5 + with: + node-version: 12.x + - name: Install Dependencies + run: yarn install --frozen-lockfile + - name: Build + run: yarn build + - name: Archive Artifacts + uses: actions/upload-artifact@v2 + with: + name: build-fe + path: | + cut-fe/dist/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..207f989 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,81 @@ +name: Release + +on: + push: + tags: + - v*.*.* + +jobs: + image: + name: Publish Image + environment: Production + runs-on: Ubuntu-20.04 + env: + APPLICATION: cut + strategy: + matrix: + service: [be, fe] + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Setup QEMU + uses: docker/setup-qemu-action@v1 + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: Get Release Version + run: echo "RELEASE_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV + - name: Provide Env File + run: | + echo "${{ secrets.FE_ENV_FILE }}" > ${{ env.APPLICATION }}-${{ matrix.service }}/.env.production + echo "VUE_APP_VERSION=${{ env.RELEASE_VERSION }}" >> ${{ env.APPLICATION }}-${{ matrix.service }}/.env.production + - name: Build and Push Image + uses: docker/build-push-action@v2 + with: + context: ${{ env.APPLICATION }}-${{ matrix.service }} + platforms: linux/amd64 + tags: | + daystram/${{ env.APPLICATION }}:${{ matrix.service }} + daystram/${{ env.APPLICATION }}:${{ matrix.service }}-${{ env.RELEASE_VERSION }} + push: true + chart: + name: Publish Helm Chart + environment: Production + runs-on: Ubuntu-20.04 + container: daystram/k8s-tools:latest + needs: [image] + env: + APPLICATION: cut + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Get Release Version + run: echo "RELEASE_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV + - name: Initialize Git Credentials + run: | + git config --global user.name "${{ secrets.BOTDAYSTRAM_NAME }}" + git config --global user.email "${{ secrets.BOTDAYSTRAM_EMAIL }}" + mkdir -p /root/.ssh && echo "${{ secrets.BOTDAYSTRAM_KEY_FILE }}" > /root/.ssh/id_rsa.github && chmod 600 /root/.ssh/id_rsa.github + cat >> /etc/ssh/ssh_config < $KUBECONFIG && chmod 700 $KUBECONFIG + - name: Build and Deploy Chart + run: | + eval `ssh-agent -s` + git clone ssh://git@github.com/daystram/helm-charts.git + cp -r .daystram helm-charts/docs/ + cd helm-charts/docs/ + curl -sfL https://charts.daystram.com/build.sh | sh -s - ${{ env.APPLICATION }} ${{ env.RELEASE_VERSION }} + rm -rf .daystram/ + git add . + git commit -m "feat: added chart for ${{ env.APPLICATION }}@${{ env.RELEASE_VERSION }}" + git push diff --git a/cut-fe/.env.development b/cut-fe/.env.development index e1529d0..6db7a5f 100644 --- a/cut-fe/.env.development +++ b/cut-fe/.env.development @@ -1,3 +1,6 @@ NODE_ENV=development BASE_URL=localhost VUE_APP_TITLE=Cut +VUE_APP_CLIENT_ID=client_id_from_ratify_be +VUE_APP_OAUTH_ISSUER=https://ratify.daystram.com +VUE_APP_VERSION=v0.0.0-development \ No newline at end of file diff --git a/cut-fe/src/styles/App.sass b/cut-fe/src/styles/App.sass index 19992a0..5c0be3e 100644 --- a/cut-fe/src/styles/App.sass +++ b/cut-fe/src/styles/App.sass @@ -9,6 +9,17 @@ html .app-subtitle max-width: 480px +.app-version + position: absolute + bottom: 32px + margin: 0 auto + left: 0 + right: 0 + text-align: center + user-select: none + -moz-user-select: none + -webkit-user-select: none + a.text-link color: white !important background-color: transparent @@ -38,4 +49,4 @@ code .danger-border border: var(--v-error-base) !important border-style: solid !important - border-width: 1px !important \ No newline at end of file + border-width: 1px !important diff --git a/cut-fe/src/views/Home.vue b/cut-fe/src/views/Home.vue index 2c3330e..0559e08 100644 --- a/cut-fe/src/views/Home.vue +++ b/cut-fe/src/views/Home.vue @@ -37,6 +37,9 @@ +
+ {{ appVersion || "" }} +
@@ -47,7 +50,11 @@ import { authManager } from "@/auth"; export default Vue.extend({ components: { Logo }, - + data() { + return { + appVersion: process.env.VUE_APP_VERSION + }; + }, computed: { isAuthenticated() { return authManager.isAuthenticated();