From c5cbdf5ae14fc2b85d296265645a1c6b5ffdf378 Mon Sep 17 00:00:00 2001 From: MattIPv4 Date: Fri, 4 Feb 2022 20:13:54 +0000 Subject: [PATCH] Use correct NPM version in Actions --- .github/workflows/do-spaces-workflow.yml | 57 +++++++++++--------- .github/workflows/gh-pages-workflow.yml | 47 +++++++++-------- .github/workflows/test-workflow.yml | 67 +++++++++++++++--------- 3 files changed, 98 insertions(+), 73 deletions(-) diff --git a/.github/workflows/do-spaces-workflow.yml b/.github/workflows/do-spaces-workflow.yml index 2e5311e..56c1a92 100644 --- a/.github/workflows/do-spaces-workflow.yml +++ b/.github/workflows/do-spaces-workflow.yml @@ -7,35 +7,40 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - - name: Read .nvmrc - run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" - id: nvm + - name: Read Node.js & NPM versions + run: | + echo "##[set-output name=NODE;]$(cat package.json | jq -r '.engines.node')" + echo "##[set-output name=NPM;]$(cat package.json | jq -r '.engines.npm')" + id: versions - - name: Use Node.js (.nvmrc) - uses: actions/setup-node@v1 - with: - node-version: "${{ steps.nvm.outputs.NVMRC }}" + - name: Use correct Node.js version + uses: actions/setup-node@v2 + with: + node-version: "${{ steps.versions.outputs.NODE }}" - - name: Install dependencies - run: npm ci + - name: Use correct NPM version + run: npm i -g npm@"${{ steps.versions.outputs.NPM }}" - - name: Build tool - run: npm run build + - name: Install dependencies + run: npm ci - - name: Deploy commit to DigitalOcean Spaces - run: aws s3 sync ./dist s3://${{ secrets.SPACES_BUCKET }}/commits/nginxconfig/${{ github.sha }} --endpoint=https://${{ secrets.SPACES_REGION }}.digitaloceanspaces.com --acl public-read --content-encoding utf8 - env: - AWS_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: ${{ secrets.SPACES_REGION }} + - name: Build tool + run: npm run build - - name: Leave a comment - run: npm run deploy:spaces:comment - env: - REPO_NAME: ${{ github.repository }} - COMMIT_SHA: ${{ github.sha }} - GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SPACES_REGION: ${{ secrets.SPACES_REGION }} - SPACES_BUCKET: ${{ secrets.SPACES_BUCKET }} + - name: Deploy commit to DigitalOcean Spaces + run: aws s3 sync ./dist s3://${{ secrets.SPACES_BUCKET }}/commits/nginxconfig/${{ github.sha }} --endpoint=https://${{ secrets.SPACES_REGION }}.digitaloceanspaces.com --acl public-read --content-encoding utf8 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: ${{ secrets.SPACES_REGION }} + + - name: Leave a comment + run: npm run deploy:spaces:comment + env: + REPO_NAME: ${{ github.repository }} + COMMIT_SHA: ${{ github.sha }} + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SPACES_REGION: ${{ secrets.SPACES_REGION }} + SPACES_BUCKET: ${{ secrets.SPACES_BUCKET }} diff --git a/.github/workflows/gh-pages-workflow.yml b/.github/workflows/gh-pages-workflow.yml index 113d905..c07d041 100644 --- a/.github/workflows/gh-pages-workflow.yml +++ b/.github/workflows/gh-pages-workflow.yml @@ -10,30 +10,35 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - - name: Read .nvmrc - run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" - id: nvm + - name: Read Node.js & NPM versions + run: | + echo "##[set-output name=NODE;]$(cat package.json | jq -r '.engines.node')" + echo "##[set-output name=NPM;]$(cat package.json | jq -r '.engines.npm')" + id: versions - - name: Use Node.js (.nvmrc) - uses: actions/setup-node@v1 - with: - node-version: "${{ steps.nvm.outputs.NVMRC }}" + - name: Use correct Node.js version + uses: actions/setup-node@v2 + with: + node-version: "${{ steps.versions.outputs.NODE }}" - - name: Install dependencies - run: npm ci + - name: Use correct NPM version + run: npm i -g npm@"${{ steps.versions.outputs.NPM }}" - - name: Test before production - run: npm test + - name: Install dependencies + run: npm ci - - name: Build tool - run: npm run build + - name: Test before production + run: npm test - - name: Deploy master to GitHub Pages - uses: JamesIves/github-pages-deploy-action@2.0.0 - env: - ACCESS_TOKEN: ${{ secrets.DEV_GITHUB_TOKEN }} - BASE_BRANCH: master - BRANCH: gh-pages - FOLDER: dist + - name: Build tool + run: npm run build + + - name: Deploy master to GitHub Pages + uses: JamesIves/github-pages-deploy-action@2.0.0 + env: + ACCESS_TOKEN: ${{ secrets.DEV_GITHUB_TOKEN }} + BASE_BRANCH: master + BRANCH: gh-pages + FOLDER: dist diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index bd0e490..20fc030 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -7,37 +7,47 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - - name: Read .nvmrc - run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" - id: nvm + - name: Read Node.js & NPM versions + run: | + echo "##[set-output name=NODE;]$(cat package.json | jq -r '.engines.node')" + echo "##[set-output name=NPM;]$(cat package.json | jq -r '.engines.npm')" + id: versions - - name: Use Node.js (.nvmrc) - uses: actions/setup-node@v1 - with: - node-version: "${{ steps.nvm.outputs.NVMRC }}" + - name: Use correct Node.js version + uses: actions/setup-node@v2 + with: + node-version: "${{ steps.versions.outputs.NODE }}" - - name: Install dependencies - run: npm ci + - name: Use correct NPM version + run: npm i -g npm@"${{ steps.versions.outputs.NPM }}" - - name: Test with eslint - run: npm run test:eslint + - name: Install dependencies + run: npm ci + + - name: Test with eslint + run: npm run test:eslint sass-lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - - name: Read .nvmrc - run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" - id: nvm + - name: Read Node.js & NPM versions + run: | + echo "##[set-output name=NODE;]$(cat package.json | jq -r '.engines.node')" + echo "##[set-output name=NPM;]$(cat package.json | jq -r '.engines.npm')" + id: versions - - name: Use Node.js (.nvmrc) - uses: actions/setup-node@v1 + - name: Use correct Node.js version + uses: actions/setup-node@v2 with: - node-version: "${{ steps.nvm.outputs.NVMRC }}" + node-version: "${{ steps.versions.outputs.NODE }}" + + - name: Use correct NPM version + run: npm i -g npm@"${{ steps.versions.outputs.NPM }}" - name: Install dependencies run: npm ci @@ -49,16 +59,21 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - - name: Read .nvmrc - run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" - id: nvm + - name: Read Node.js & NPM versions + run: | + echo "##[set-output name=NODE;]$(cat package.json | jq -r '.engines.node')" + echo "##[set-output name=NPM;]$(cat package.json | jq -r '.engines.npm')" + id: versions - - name: Use Node.js (.nvmrc) - uses: actions/setup-node@v1 + - name: Use correct Node.js version + uses: actions/setup-node@v2 with: - node-version: "${{ steps.nvm.outputs.NVMRC }}" + node-version: "${{ steps.versions.outputs.NODE }}" + + - name: Use correct NPM version + run: npm i -g npm@"${{ steps.versions.outputs.NPM }}" - name: Install dependencies run: npm ci