From 52c684dab3865a2e14408fce527f6846a5cd0980 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Fri, 1 Sep 2023 13:41:57 +0200 Subject: [PATCH] CI: cleanup actions, move REUSE compliance check into every deploy --- .github/actions/setup-and-validate/action.yml | 3 ++ .github/workflows/deploy_dev.yml | 5 +- ...idation_and_deploy.yml => deploy_prod.yml} | 5 +- .github/workflows/reuse-compliance-check.yml | 11 ---- .github/workflows/validate-pr.yml | 52 +------------------ .github/workflows/validate_translations.yml | 37 ------------- 6 files changed, 10 insertions(+), 103 deletions(-) rename .github/workflows/{theme_validation_and_deploy.yml => deploy_prod.yml} (95%) delete mode 100644 .github/workflows/reuse-compliance-check.yml delete mode 100644 .github/workflows/validate_translations.yml diff --git a/.github/actions/setup-and-validate/action.yml b/.github/actions/setup-and-validate/action.yml index ae17ad39e..51201b958 100644 --- a/.github/actions/setup-and-validate/action.yml +++ b/.github/actions/setup-and-validate/action.yml @@ -18,6 +18,9 @@ runs: run: npm ci shell: bash + - name: REUSE compliance check + uses: fsfe/reuse-action@v2 + - name: create generated dir run: mkdir ./assets/generated shell: bash diff --git a/.github/workflows/deploy_dev.yml b/.github/workflows/deploy_dev.yml index 74f14f93a..d92079aec 100644 --- a/.github/workflows/deploy_dev.yml +++ b/.github/workflows/deploy_dev.yml @@ -1,4 +1,4 @@ -name: Deploy on dev.mapcomplete.org +name: Deploy develop on dev.mapcomplete.org on: push: branches: @@ -8,7 +8,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Node.js uses: actions/setup-node@v3 @@ -69,6 +69,7 @@ jobs: cp -r dist/* mapcomplete-dev/ cd mapcomplete-dev/ echo "dev.mapcomplete.org" > CNAME + touch .nojekyll git add * if git status | grep -q "Changes to be committed" then diff --git a/.github/workflows/theme_validation_and_deploy.yml b/.github/workflows/deploy_prod.yml similarity index 95% rename from .github/workflows/theme_validation_and_deploy.yml rename to .github/workflows/deploy_prod.yml index 35c92a86b..1532d8e8d 100644 --- a/.github/workflows/theme_validation_and_deploy.yml +++ b/.github/workflows/deploy_prod.yml @@ -1,4 +1,4 @@ -name: Theme Validation and deployment +name: Deploy master on mapcomplete.org on: push: branches: @@ -8,7 +8,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Node.js uses: actions/setup-node@v3 @@ -69,6 +69,7 @@ jobs: cp -r dist/* mapcomplete.github.io/ cd mapcomplete.github.io/ echo "mapcomplete.org" > CNAME + touch .nojekyll git add * if git status | grep -q "Changes to be committed" then diff --git a/.github/workflows/reuse-compliance-check.yml b/.github/workflows/reuse-compliance-check.yml deleted file mode 100644 index dd9c31b80..000000000 --- a/.github/workflows/reuse-compliance-check.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: REUSE Compliance Check - -on: [push, pull_request] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: REUSE Compliance Check - uses: fsfe/reuse-action@v2 diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index 2e897022b..ebc4d9af8 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -1,4 +1,4 @@ -name: Build and validate PR +name: Build and validate PR (but don't deploy) on: pull_request: @@ -38,53 +38,3 @@ jobs: - name: run tests run: npm run test shell: bash - - - name: Prepare deploy - run: npm run prepare-deploy - shell: bash - - name: Clone deployment repo - env: - DEPLOY_KEY_PIETERVDVN: ${{ secrets.DEPLOY_KEY_PIETERVDVN }} - run: | - echo "Cloning destination repo" - git config --global user.email "pietervdvn@posteo.net" - git config --global user.name "pietervdvn" - git clone --depth 1 --single-branch --branch master "https://x-access-token:$DEPLOY_KEY_PIETERVDVN@github.com/pietervdvn/pietervdvn.github.io.git" - echo "Destination repo is cloned" - - - name: Sync repo - env: - DEPLOY_KEY_PIETERVDVN: ${{ secrets.DEPLOY_KEY_PIETERVDVN }} - run: | - cd pietervdvn.github.io - git pull - - - name: get branch name - run: echo TARGET_BRANCH=${GITHUB_REF:11} >> $GITHUB_ENV - - - name: "Copying files" - run: | - echo "Deploying" - rm -rf pietervdvn.github.io/mc/${{ env.TARGET_BRANCH }}/* - mkdir -p pietervdvn.github.io/mc/${{ env.TARGET_BRANCH }}/ - cp -r dist/* pietervdvn.github.io/mc/${{ env.TARGET_BRANCH }}/ - cd pietervdvn.github.io/ - git add * - if git status | grep -q "Changes to be committed" - then - git commit -am "Deploying a new version of mapcomplete" - git push - else - echo "No changes to commit" - fi - env: - TARGET_BRANCH: ${{ env.TARGET_BRANCH }} - - - uses: mshick/add-pr-comment@v1 - name: Comment the PR with the review URL - if: ${{ success() && github.ref != 'refs/heads/develop' && github.ref != 'refs/heads/master' }} - with: - message: | - [🚀 Preview Branch](https://pietervdvn.github.io/mc/${{ env.TARGET_BRANCH }}) - repo-token: ${{ secrets.GITHUB_TOKEN }} - diff --git a/.github/workflows/validate_translations.yml b/.github/workflows/validate_translations.yml deleted file mode 100644 index 6f07d343a..000000000 --- a/.github/workflows/validate_translations.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Deployment on pietervdvn -on: - pull_request - -jobs: - build: - runs-on: ubuntu-latest - if: ${{ github.actor == 'weblate' }} - steps: - - uses: actions/checkout@v2 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "16" - cache: "npm" - cache-dependency-path: package-lock.json - - - name: install deps - run: npm ci - shell: bash - - - name: create generated dir - run: mkdir ./assets/generated - shell: bash - - - name: sync translations - run: npm run generate:translations - shell: bash - - - name: generate layeroverview - run: npm run reset:layeroverview - shell: bash - - - name: run tests - run: npm run test - shell: bash