forked from iScsc/blog.iscsc.fr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deploy to
dev.iscsc.fr
workflow (iScsc#61)
* Add deploy dev wokflow: a github action to be manually deploy a PR to remote * Fix deploy_dev workflow URL and build location * TO REVERT: Add fake article to test the workflow * Make deploy_dev workflow trigger on pull_request and need a maintainer approval * Fix deploy dev docker compose builder building to the wrong directory * Revert "TO REVERT: Add fake article to test the workflow" This reverts commit 02ee2ff. * Add a development warning banner before building the development website * Fix trailing whitespace * Fix workflow comments * Remove version statement in docker-compose.dev.yml
- Loading branch information
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Build and deploy a PR on dev.iscsc.fr | ||
|
||
on: | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Trigger the workflow on every pull request, but because of the environment (later defined) | ||
# it will require manual approval to run | ||
pull_request: | ||
|
||
jobs: | ||
# Build job | ||
build-and-deploy-dev: | ||
runs-on: ubuntu-latest | ||
# Force to respect the 'dev-deployment' environment rules, in our case 1 maintainer approval | ||
environment: deployment-dev | ||
steps: | ||
# Checkout repo AND ITS SUBMODULES | ||
- name: π Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: π Inject Development Banner | ||
run: | | ||
cat ./development_banner.html >> ./src/themes/poison/layouts/partials/sidebar/sidebar.html | ||
# Build the static website with the provided docker-compose rules, overriding some elements, see docker-compose.dev.yml | ||
- name: π οΈ Build with HUGO | ||
run: | | ||
docker compose -f docker-compose.yml -f docker-compose.dev.yml run builder | ||
# Create the SSH key file and fill the known_hosts to avoid a prompt from ssh (1st time connecting to remote host) | ||
- name: π Create Key File | ||
run: | | ||
mkdir ~/.ssh | ||
touch ~/.ssh/id_rsa | ||
chmod 600 ~/.ssh/id_rsa | ||
- name: π Load Host Keys | ||
run: | | ||
echo "${{ secrets.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts | ||
- name: π Populate Key | ||
run: | | ||
echo "${{ secrets.PRIVATE_SSH_KEY }}" > ~/.ssh/id_rsa | ||
# Upload the build to the remote server location: the volume shared by the nginx container serving http requests | ||
- name: π Upload | ||
run: | | ||
rsync --archive --stats --verbose --delete ./build/blog/dev/* ${{ secrets.CI_USER_NAME }}@iscsc.fr:${{ secrets.REPO_PATH_ON_REMOTE }}/build/blog/dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div style="background-color:red; color: white; font-size: 2rem; text-align: center; position: fixed; width: 100%; margin-bottom: 50rem;"> | ||
THIS IS A DEVELOPMENT WEBSITE, please go to <a href="https://iscsc.fr" style="font-weight: bold; color:darkslategrey;">https://iscsc.fr</a> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
services: | ||
builder: | ||
command: --logLevel info --baseURL="https://dev.iscsc.fr" --buildFuture | ||
volumes: | ||
# The container is mode-agnostique: it always builds in /build/blog | ||
# the volume shared on the host side determines where it should go | ||
- ./build/blog/dev:/build/blog:rw |