Skip to content

Merge pull request #126 from noi-techpark/main #178

Merge pull request #126 from noi-techpark/main

Merge pull request #126 from noi-techpark/main #178

Workflow file for this run

name: CI/CD
on:
push:
pull_request:
env:
AWS_REGION : "eu-west-1"
NODE_VERSION: 16.x
WORKING_DIRECTORY: mail-client
jobs:
test:
runs-on: ubuntu-22.04
env:
HOME: '.'
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1
- name: Install hugo
run: sudo apt-get install hugo
- name: Test hugo
run: hugo -s src -d ../target
- uses: actions/setup-node@v2
with:
node-version: '16.x'
# disable caching since it causes problems on post Run:
# Post job cleanup.
# /opt/hostedtoolcache/node/12.22.9/x64/bin/npm config get cache
# /home/runner/work/software-website/software-website/.npm
# Error: Cache folder path is retrieved for npm but doesn't exist on disk: /home/runner/work/software-website/software-website/.npm
# cache: 'npm'
# cache-dependency-path: mail-client/package.json
- name: mail client
run : npm install
working-directory: mail-client
deploy-test:
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/main'
needs: test
concurrency: deploy-test
env:
AWS_S3_BUCKET_NAME : 'it.bz.freesoftwarelab.test'
HUGO_BASEURL: 'https://freesoftwarelab.noi.testingmachine.eu/'
MAIL_CLIENT: 'https://mail.software.bz.it/'
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install hugo
run: sudo apt-get install hugo
- name: Configuration hugo
run: |
sed -i -e "s%https://example.com%${{env.MAIL_CLIENT}}%g" src/themes/free-software-lab/static/js/main.js
sed -i -e "s%https://example.com%${{env.HUGO_BASEURL}}%g" src/config.toml
- name: Build hugo
run: hugo -s src -d ../target
- name: Sync to S3 bucket
uses: noi-techpark/github-actions/aws-s3-bucket-sync@v2
with:
access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}
region: ${{ env.AWS_REGION }}
s3-bucket-name: ${{ env.AWS_S3_BUCKET_NAME }}
folder: ./target
deploy-prod:
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/prod'
needs: test
concurrency: deploy-prod
env:
AWS_S3_BUCKET_NAME : "it.bz.freesoftwarelab"
HUGO_BASEURL: 'https://freesoftwarelab.noi.bz.it/'
MAIL_CLIENT: 'https://mail.software.bz.it/'
SCRIPTS_HOST: 'https://scripts.opendatahub.com'
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install hugo
run: sudo apt-get install hugo
- name: Configuration hugo
run: |
sed -i -e "s%https://example.com%${{env.MAIL_CLIENT}}%g" src/themes/free-software-lab/static/js/main.js
sed -i -e "s%https://example.com%${{env.HUGO_BASEURL}}%g" src/config.toml
- name: Change scripts host to prod
run: |
sed -i -e "s%https://scripts.opendatahub.testingmachine.eu%${{env.SCRIPTS_HOST}}%g" src/themes/free-software-lab/layouts/partials/footer.html
sed -i -e "s%https://scripts.opendatahub.testingmachine.eu%${{env.SCRIPTS_HOST}}%g" src/themes/free-software-lab/layouts/partials/head.html
- name: Build hugo
run: hugo -s src -d ../target
- name: Sync to S3 bucket
uses: noi-techpark/github-actions/aws-s3-bucket-sync@v2
with:
access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}
region: ${{ env.AWS_REGION }}
s3-bucket-name: ${{ env.AWS_S3_BUCKET_NAME }}
folder: ./target