Skip to content

Commit

Permalink
remove env vars
Browse files Browse the repository at this point in the history
And add environments and permissions
  • Loading branch information
NicolasMassart committed Jan 7, 2022
1 parent 1321ade commit e2579ee
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 51 deletions.
19 changes: 0 additions & 19 deletions .env

This file was deleted.

14 changes: 14 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
###############################################
# Project environment variables #
# Uncomment the line to use and set the value #
###############################################

## Docker compose variables
#DOCTOOLS_IMAGE_VERSION # Docker compose image. Default to 'latest'.

## MkDocs variables
#DEBUG=true # uncomment to output debug infos in HTML source code. Requires MINIFY=false
#VERSION=1.2.3 # uncomment to force a version number on your local preview
#LANGUAGE # Two letters language code. Default language is 'en'
#PREBUILD_INDEX=false # uncomment to speedup your preview build (will slow down searches)
#MINIFY=false # uncomment to prevent HTML/CSS/JS code to be minified. Useful for debug.
15 changes: 4 additions & 11 deletions .github/workflows/latest_publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
name: Publish latest doc site

# Controls when the action will run.
on:
push:
branches: [main]
Expand All @@ -11,6 +10,9 @@ jobs:
deploy:
name: Build and publish latest site
runs-on: ubuntu-latest
environment: production
permissions:
contents: read
# secrets are not usable from outside ConsenSys org
# The workflow will then be disabled for non ConsenSys repositories to prevent useless failure.
# Restricting to refs/heads/main here to prevent workflow_dispatch to run on another branch
Expand All @@ -21,15 +23,6 @@ jobs:
with:
fetch-depth: 0 # Required for mkdocs to be able to display pages last update info

- name: set environment vars from .env file
uses: c-py/action-dotenv-to-setenv@a6380f4d905f42adb7c065db63e6d66d75b971ad #v3
with:
env-file: '.env'

- name: Set non empty LANGUAGE env
shell: sh
run: echo "LANGUAGE=${LANGUAGE:-en}" >> $GITHUB_ENV

- name: Publish latest version to AWS
uses: ConsenSys/doctools.action-builder/actions/latest-publish@main
with:
Expand All @@ -39,4 +32,4 @@ jobs:
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
PROJECT: ${{ secrets.PROJECT }}
LANGUAGE: ${{ env.LANGUAGE }}
LANGUAGE: 'en'
3 changes: 3 additions & 0 deletions .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ jobs:
links-check:
name: Check links
runs-on: ubuntu-latest
environment: no-secret
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ jobs:
lint:
name: Lint Code Base
runs-on: ubuntu-latest
environment: no-secret
permissions:
contents: read
steps:
- uses: actions/checkout@v2
with:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/pr_preview_delete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ jobs:
deploy:
name: Remove PR preview from pages
runs-on: ubuntu-latest
environment: no-secret
permissions:
contents: write
pull-requests: write

steps:
- name: 'checkout code from repos'
uses: actions/checkout@v2
Expand Down
17 changes: 6 additions & 11 deletions .github/workflows/pr_preview_publish.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
---
name: Publish PR preview

# Controls when the action will run.
on: [ pull_request_target ]

jobs:
deploy:
name: Build and publish PR preview
runs-on: ubuntu-latest
environment: preview
permissions:
contents: write
pull-requests: write

steps:
- name: checkout code from repos
uses: actions/checkout@v2
with:
ref: refs/pull/${{ github.event.number }}/merge # required to pull the PR code instead of the main one
fetch-depth: 0 # Required for mkdocs to be able to display pages last update info

- name: set environment vars from .env file
uses: c-py/action-dotenv-to-setenv@a6380f4d905f42adb7c065db63e6d66d75b971ad #v3
with:
env-file: '.env'

- name: Set non empty LANGUAGE env
shell: sh
run: echo "LANGUAGE=${LANGUAGE:-en}" >> $GITHUB_ENV

- name: Build and publish PR preview
uses: ConsenSys/doctools.action-builder/actions/pr-preview-publish@main
with:
LANGUAGE: ${{ env.LANGUAGE }}
LANGUAGE: 'en' # we do not have any other languages for the moment, will update when needed
14 changes: 4 additions & 10 deletions .github/workflows/release_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ jobs:
deploy:
name: Build and publish released site
runs-on: ubuntu-latest
environment: production
permissions:
contents: read
# secrets are not usable from outside ConsenSys org
# The workflow will then be disabled for non ConsenSys repositories to prevent useless failure.
if: github.event.repository.fork == false && github.repository_owner == 'ConsenSys'
Expand All @@ -19,15 +22,6 @@ jobs:
with:
fetch-depth: 0 # Required for mkdocs to be able to display pages last update info

- name: set environment vars from .env file
uses: c-py/action-dotenv-to-setenv@a6380f4d905f42adb7c065db63e6d66d75b971ad #v3
with:
env-file: '.env'

- name: Set non empty LANGUAGE env
shell: sh
run: echo "LANGUAGE=${LANGUAGE:-en}" >> $GITHUB_ENV

- name: Publish release version to AWS
uses: ConsenSys/doctools.action-builder/actions/release-publish@main
with:
Expand All @@ -37,4 +31,4 @@ jobs:
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
PROJECT: ${{ secrets.PROJECT }}
LANGUAGE: ${{ env.LANGUAGE }}
LANGUAGE: 'en'
3 changes: 3 additions & 0 deletions .github/workflows/spelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
spelling:
name: Vale
runs-on: ubuntu-latest
environment: no-secret
permissions:
contents: read
steps:
- uses: actions/checkout@v2
- name: create style dir
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ common/
.doctools.action-builder
docker-compose.dev.yml
.env.dev
.env
__pycache__
/.run/
*.log

0 comments on commit e2579ee

Please sign in to comment.