Repository navigation
149 lines (140 loc) · 4.65 KB
/
Copy pathdev_opened_or_updated.yml
File metadata and controls
149 lines (140 loc) · 4.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
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
permissions: {}
jobs:
i18n:
permissions:
contents: read
runs-on: [self-hosted, common]
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-node@v7
with:
node-version: "24"
check-latest: true
- name: Check missing translations
run: npm run i18n:check
build-and-push:
permissions:
contents: read
runs-on: [self-hosted, common]
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.ref }}
persist-credentials: false
- name: Login to BIMData Docker Registry
uses: docker/login-action@v4
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@v7
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 }}
unit-tests:
permissions:
contents: read
runs-on: [self-hosted, common]
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-node@v7
with:
node-version: "24"
check-latest: true
- name: Run unit tests
run: npm ci && npm run test:unit
# e2e-tests:
# permissions:
# contents: read
# 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@v7
# with:
# repository: bimdata/bimdata-test
# ref: master
# token: ${{ secrets.REPOS_TOKEN }}
# persist-credentials: false
# - 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:
permissions:
contents: read
pull-requests: write # Needed for PR title updates
runs-on: [self-hosted, common]
needs: build-and-push
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.ref }}
persist-credentials: false
- name: Login to BIMData Docker Registry
uses: docker/login-action@v4
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: bimdata/actions/platform-dev-link@v6.1
with:
platform_url: ${{ steps.platform.outputs.url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}