From ca7223c7e1cbfac6ad9c11488c87fee5ad5f83db Mon Sep 17 00:00:00 2001 From: rug Date: Tue, 24 Oct 2023 12:41:47 +0200 Subject: [PATCH 1/8] Adding git action --- .github/manual-commit/action.yml | 30 ++++++++++++++++++++++++ .github/setup-gpg/action.yml | 22 ++++++++++++++++++ .github/signed-commit/action.yml | 39 ++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 .github/manual-commit/action.yml create mode 100644 .github/setup-gpg/action.yml create mode 100644 .github/signed-commit/action.yml diff --git a/.github/manual-commit/action.yml b/.github/manual-commit/action.yml new file mode 100644 index 00000000..0aa04e76 --- /dev/null +++ b/.github/manual-commit/action.yml @@ -0,0 +1,30 @@ +name: 'manual-git-commit' +description: 'Runs the git command to commit' +inputs: + branch: + description: 'Branch where to commit.' + required: true + default: '' + message: + description: 'Commit message.' + required: true + default: '' + newFiles: + description: 'Defines if a `git add.` should be made or not.' + required: false + default: false + +runs: + using: composite + steps: + - name: Add new files (if needed) + shell: bash + if: ${{ inputs.newFiles }} + run: | + git add . + + - name: Manual git commit + shell: bash + run: | + git commit -m "${{ inputs.message }}" + git push origin ${{ inputs.branch }} diff --git a/.github/setup-gpg/action.yml b/.github/setup-gpg/action.yml new file mode 100644 index 00000000..33068ffb --- /dev/null +++ b/.github/setup-gpg/action.yml @@ -0,0 +1,22 @@ +name: 'setup-gpg' +description: 'Prepare to get following commits signed' +inputs: + gpgPriv: + description: 'GPG Private key' + required: true + default: '' + gpgPassPhrase: + description: 'GPG passphrase' + required: false + default: '""' + +runs: + using: composite + steps: + - name: Import and load GPG key + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ inputs.gpgPriv }} + passphrase: ${{ inputs.gpgPassPhrase }} + git_user_signingkey: true + git_commit_gpgsign: true diff --git a/.github/signed-commit/action.yml b/.github/signed-commit/action.yml new file mode 100644 index 00000000..a997e72b --- /dev/null +++ b/.github/signed-commit/action.yml @@ -0,0 +1,39 @@ +name: 'signed-gpg-commit' +description: 'Prepare and sign the commit signed' +inputs: + branch: + description: 'Branch where to commit.' + required: true + default: '' + message: + description: 'Commit message.' + required: true + default: '' + newFiles: + description: 'Defines if a `git add.` should be made or not.' + required: false + default: false + gpgPriv: + description: 'GPG Private key' + required: true + default: '' + gpgPassPhrase: + description: 'GPG passphrase' + required: false + default: '""' + +runs: + using: composite + steps: + - name: Setup GPG to sign commits + uses: ./.github/setup-gpg/ + with: + gpgPriv: ${{ inputs.gpgPriv }} + gpgPassPhrase: ${{ inputs.gpgPassPhrase }} + + - name: Perform git commit + uses: ./.github/manual-commit/ + with: + branch: ${{ inputs.branch }} + message: ${{ inputs.message }} + newFiles: ${{ inputs.newFiles }} From a52d1f75aa9e991e8be3db53def4c634c38726e6 Mon Sep 17 00:00:00 2001 From: rug Date: Tue, 24 Oct 2023 12:46:40 +0200 Subject: [PATCH 2/8] Adding workflow to generate documentation in dev --- .github/workflows/dev.yml | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/dev.yml diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 00000000..27c694eb --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,41 @@ +name: CI +on: + # Triggers the workflow on push events but only for the "dev" branch. + push: + branches: ['dev'] + +jobs: + build: + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout branch dev + uses: actions/checkout@v3 + with: + ref: dev + token: ${{ secrets.PAT }} + + - name: Install graphviz + run: sudo apt install -y graphviz + + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: 'npm' + + - name: Install project dependencies + run: npm install + + - name: Generate documentation + run: npm run docs + + - name: Sign and commit documentation to branch dev + uses: ./.github/signed-commit/ + with: + branch: dev + message: 'Update documentation [skip ci]' + newFiles: true + gpgPriv: ${{ secrets.GPG_SIGN_KEY }} + gpgPassPhrase: ${{ secrets.GPG_PASSPHRASE }} From 7324c23b3b2141961b0f250f45bbc007633ae98e Mon Sep 17 00:00:00 2001 From: rug Date: Tue, 24 Oct 2023 13:23:46 +0200 Subject: [PATCH 3/8] Changes in workflows --- .github/workflows/dev-pr.yml | 44 ++++++++++++++++++++++++++++++++++++ .github/workflows/dev.yml | 41 --------------------------------- 2 files changed, 44 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/dev-pr.yml delete mode 100644 .github/workflows/dev.yml diff --git a/.github/workflows/dev-pr.yml b/.github/workflows/dev-pr.yml new file mode 100644 index 00000000..cad51840 --- /dev/null +++ b/.github/workflows/dev-pr.yml @@ -0,0 +1,44 @@ +name: CI +on: + # Triggers the workflow on push events but only for the "dev" branch. + pull_request: + branches: ['dev'] + + workflow_dispatch: + +jobs: + eslint: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./ + steps: + - name: Checkout branch dev + uses: actions/checkout@v2 + + - uses: actions/setup-node@v1 + with: + node-version: '16.x' + + - name: Install project dependencies + run: npm install + + - name: Run lint + run: npm run lint + + compile: + needs: eslint + runs-on: ubuntu-latest + steps: + - name: Checkout branch dev + uses: actions/checkout@v2 + + - uses: actions/setup-node@v1 + with: + node-version: '16.x' + + - name: Install project dependencies + run: npm install + + - name: Compile code + run: npm run build diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml deleted file mode 100644 index 27c694eb..00000000 --- a/.github/workflows/dev.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: CI -on: - # Triggers the workflow on push events but only for the "dev" branch. - push: - branches: ['dev'] - -jobs: - build: - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Checkout branch dev - uses: actions/checkout@v3 - with: - ref: dev - token: ${{ secrets.PAT }} - - - name: Install graphviz - run: sudo apt install -y graphviz - - - uses: actions/setup-node@v3 - with: - node-version: 16 - cache: 'npm' - - - name: Install project dependencies - run: npm install - - - name: Generate documentation - run: npm run docs - - - name: Sign and commit documentation to branch dev - uses: ./.github/signed-commit/ - with: - branch: dev - message: 'Update documentation [skip ci]' - newFiles: true - gpgPriv: ${{ secrets.GPG_SIGN_KEY }} - gpgPassPhrase: ${{ secrets.GPG_PASSPHRASE }} From 04aa19b6eb4045e6148f22951b6c70a3ba129b4c Mon Sep 17 00:00:00 2001 From: rug Date: Tue, 24 Oct 2023 13:25:05 +0200 Subject: [PATCH 4/8] Create main-push.yml --- .github/workflows/main-push.yml | 86 +++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/main-push.yml diff --git a/.github/workflows/main-push.yml b/.github/workflows/main-push.yml new file mode 100644 index 00000000..9e0c84ec --- /dev/null +++ b/.github/workflows/main-push.yml @@ -0,0 +1,86 @@ +# This is a basic workflow to help you get started with Actions + +name: MAIN_PUSH + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the dev branch + push: + branches: ['main'] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + eslint: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./ + steps: + - name: Checkout branch main + uses: actions/checkout@v2 + + - uses: actions/setup-node@v1 + with: + node-version: '16.x' + + - name: Install project dependencies + run: npm install + + - name: Run lint + run: npm run lint + + compile-code: + needs: eslint + runs-on: ubuntu-latest + steps: + - name: Checkout branch dev + uses: actions/checkout@v2 + + - uses: actions/setup-node@v1 + with: + node-version: '16.x' + + - name: Install project dependencies + run: npm install + + - name: Compile code + run: npm run build + + documentation: + needs: compile-code + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout branch main + uses: actions/checkout@v3 + with: + ref: dev + token: ${{ secrets.PAT }} + + - name: Install graphviz + run: sudo apt install -y graphviz + + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: 'npm' + + - name: Install project dependencies + run: npm install + + - name: Generate documentation + run: npm run docs + + - name: Sign and commit documentation to branch dev + uses: ./.github/signed-commit/ + with: + branch: main + message: 'Update documentation [skip ci]' + newFiles: true + gpgPriv: ${{ secrets.GPG_SIGN_KEY }} + gpgPassPhrase: ${{ secrets.GPG_PASSPHRASE }} From 4050ecccbc591a30b286dd694f7b082ada68597f Mon Sep 17 00:00:00 2001 From: rug Date: Tue, 24 Oct 2023 13:25:19 +0200 Subject: [PATCH 5/8] Changing workflow name --- .github/workflows/dev-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-pr.yml b/.github/workflows/dev-pr.yml index cad51840..506a3abb 100644 --- a/.github/workflows/dev-pr.yml +++ b/.github/workflows/dev-pr.yml @@ -1,4 +1,4 @@ -name: CI +name: DEV_PR on: # Triggers the workflow on push events but only for the "dev" branch. pull_request: From b884ef7f05a36b8c0af36126ac376b684fe40f2e Mon Sep 17 00:00:00 2001 From: rug Date: Tue, 24 Oct 2023 13:35:24 +0200 Subject: [PATCH 6/8] Update dev-pr.yml --- .github/workflows/dev-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-pr.yml b/.github/workflows/dev-pr.yml index 506a3abb..18432f30 100644 --- a/.github/workflows/dev-pr.yml +++ b/.github/workflows/dev-pr.yml @@ -26,7 +26,7 @@ jobs: - name: Run lint run: npm run lint - compile: + compile-code: needs: eslint runs-on: ubuntu-latest steps: From 6f65d0556a415e772622d3a3d263859931611681 Mon Sep 17 00:00:00 2001 From: rug Date: Tue, 24 Oct 2023 15:17:02 +0200 Subject: [PATCH 7/8] Moving actions into folder --- .github/{ => os-git-actions}/manual-commit/action.yml | 0 .github/{ => os-git-actions}/setup-gpg/action.yml | 0 .github/{ => os-git-actions}/signed-commit/action.yml | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename .github/{ => os-git-actions}/manual-commit/action.yml (100%) rename .github/{ => os-git-actions}/setup-gpg/action.yml (100%) rename .github/{ => os-git-actions}/signed-commit/action.yml (100%) diff --git a/.github/manual-commit/action.yml b/.github/os-git-actions/manual-commit/action.yml similarity index 100% rename from .github/manual-commit/action.yml rename to .github/os-git-actions/manual-commit/action.yml diff --git a/.github/setup-gpg/action.yml b/.github/os-git-actions/setup-gpg/action.yml similarity index 100% rename from .github/setup-gpg/action.yml rename to .github/os-git-actions/setup-gpg/action.yml diff --git a/.github/signed-commit/action.yml b/.github/os-git-actions/signed-commit/action.yml similarity index 100% rename from .github/signed-commit/action.yml rename to .github/os-git-actions/signed-commit/action.yml From 56641ac0b16ae0f5b147eabb23dcd9b02c9538c5 Mon Sep 17 00:00:00 2001 From: rug Date: Tue, 24 Oct 2023 15:17:25 +0200 Subject: [PATCH 8/8] Chaning workflow to use new folder --- .github/workflows/main-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main-push.yml b/.github/workflows/main-push.yml index 9e0c84ec..e62c5e03 100644 --- a/.github/workflows/main-push.yml +++ b/.github/workflows/main-push.yml @@ -77,7 +77,7 @@ jobs: run: npm run docs - name: Sign and commit documentation to branch dev - uses: ./.github/signed-commit/ + uses: ./.github/os-git-actions/signed-commit/ with: branch: main message: 'Update documentation [skip ci]'