Skip to content

Commit 07f2b91

Browse files
committed
fixup! chore: add deployment CI to OVH
1 parent 0a6caf1 commit 07f2b91

2 files changed

Lines changed: 20 additions & 7 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
uses: ./.github/workflows/ovh.yaml
1616
with:
1717
environment_name: ${{ github.event_name == 'push' && 'production' || format('pull/{0}', github.event.pull_request.number) }}
18-
url: ${{ github.event_name == 'pull_request' && format('https://mixxx-pullrequests.acolombier.dev/pr/{0}', github.event.pull_request.number) || 'https://mixxx.acolombier.dev' }}
18+
url: ${{ github.event_name == 'pull_request' && format('https://{0}/pr/{1}', env.PREVIEW_WEBSITE, github.event.pull_request.number) || format('https://{0}', env.MAIN_WEBSITE) }}
1919
target: ${{ github.event_name == 'pull_request' && format('pulls/pr/{0}', github.event.pull_request.number) || 'www' }}
2020
action: deploy
2121
secrets: inherit

.github/workflows/ovh.yaml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ on:
2525
OVH_PASSWORD:
2626
required: true
2727

28+
env:
29+
MAIN_WEBSITE: mixxx.acolombier.dev
30+
PREVIEW_WEBSITE: mixxx-pullrequests.acolombier.dev
31+
2832
jobs:
2933
apply:
3034
runs-on: ubuntu-latest
@@ -54,12 +58,21 @@ jobs:
5458
sudo apt-get update
5559
sudo apt-get install -y lftp
5660
57-
# - name: Setup PR website
58-
# run: |
59-
# cat >> .htaccess <<EOF
60-
# Options -Indexes
61-
# ErrorDocument 403 https://mixxx-pullrequests.acolombier.dev
62-
# EOF
61+
- name: Setup PR website HTACCESS
62+
if: ${{ inputs.target != 'www' }}
63+
env:
64+
OVH_USERNAME: ${{ secrets.OVH_USERNAME }}
65+
OVH_HOSTNAME: ${{ secrets.OVH_HOSTNAME }}
66+
LFTP_PASSWORD: ${{ secrets.OVH_PASSWORD }}
67+
run: |
68+
mkdir -p ${HOME}/.ssh/
69+
ssh-keyscan "${OVH_HOSTNAME}" >> "${HOME}/.ssh/known_hosts"
70+
cat >> .htaccess <<EOF
71+
Options -Indexes
72+
ErrorDocument 403 https://$MAIN_WEBSITE
73+
EOF
74+
lftp --env-password -u ${OVH_USERNAME} sftp://${OVH_HOSTNAME} \
75+
-e "put .htaccess -o /home/${OVH_USERNAME}/pulls/.htaccess"
6376
6477
- name: Build
6578
if: ${{ inputs.action != 'teardown' }}

0 commit comments

Comments
 (0)