Skip to content

Feature: Photopshere Viewer #870

Feature: Photopshere Viewer

Feature: Photopshere Viewer #870

name: Platform dev created or updated
on:
pull_request:
types: [opened, synchronize, edited]
concurrency:
group: dev-${{ github.head_ref }}
cancel-in-progress: true
env:
app: platform
jobs:
build-and-push:
runs-on: [self-hosted, common]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Login to BIMData Docker Registry
uses: docker/login-action@v3
with:
registry: docker-registry.bimdata.io
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Define branch_name var
id: branch
run: |
echo "name=$(echo dev_${GITHUB_HEAD_REF##*/} | tr ' .-' _ | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: etc/Dockerfile
push: true
pull: true
tags: |
docker-registry.bimdata.io/bimdata/${{ env.app }}:${{ github.sha }}
docker-registry.bimdata.io/bimdata/${{ env.app }}:${{ steps.branch.outputs.name }}
e2e-tests:
runs-on: [self-hosted, testendtoend]
if: ${{ !contains(github.event.pull_request.body , '[ ] I want to run the tests for the commits of this PR') }}
needs: build-and-push
steps:
- uses: actions/checkout@v4
with:
repository: bimdata/bimdata-test
ref: master
token: ${{ secrets.REPOS_TOKEN }}
- name: Define branch_name var
id: branch
run: |
echo "name=$(echo dev_${GITHUB_HEAD_REF##*/} | tr ' .-' _ | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Run e2e tests
uses: ./end-to-end/
with:
docker_tag: staging
docker_platform_tag: ${{ steps.branch.outputs.name }}
ref: ${{ github.ref }}
github_token: ${{ secrets.REPOS_TOKEN }}
vault_passwd: ${{ secrets.VAULT_PASSWD }}
cypress_version: 13.1.0
deploy:
runs-on: [self-hosted, common]
needs: build-and-push
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Login to BIMData Docker Registry
uses: docker/login-action@v3
with:
registry: docker-registry.bimdata.io
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Define branch_name var
id: branch
run: |
echo "name=$(echo dev_${GITHUB_HEAD_REF##*/} | tr ' .-' _ | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Deploy on staging
env:
BRANCH_NAME: ${{ steps.branch.outputs.name }}
run: |
docker run \
--pull always \
--rm \
-e ANSIBLE_VAULT_PASSWD="${{ secrets.ANSIBLE_VAULT_PASSWD }}" \
docker-registry.bimdata.io/bimdata/deployment:latest \
ansible-playbook \
-u deploy \
-i inventories/staging \
--tags platform_dev \
--extra-vars "branch_name=${BRANCH_NAME} ansible_ssh_private_key_file=./files/deploy_rsa" \
deploy.yml
- name: Define platform url
id: platform
run: |
echo "url=https://platform-dev-$(echo ${GITHUB_HEAD_REF##*/} | tr ' ._' - | tr '[:upper:]' '[:lower:]').bimdata.io" >> $GITHUB_OUTPUT
- name: Edit PR title with ${{ steps.platform.outputs.url }}
uses: ./.github/actions/pr-title-update
with:
platform_url: ${{ steps.platform.outputs.url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}