mirror of
				https://github.com/digitalocean/nginxconfig.io.git
				synced 2025-11-04 09:26:11 +08:00 
			
		
		
		
	Update checkout + node actions in workflows, use .nvmrc + caching (#387)
* Update workflows to resolve node version from nvmrc * Bump actions/checkout to v3 * Add step to resolve package.json engines.npm version specifically * Remove wrong committed .npmrc file
This commit is contained in:
		
							
								
								
									
										26
									
								
								.github/workflows/do-spaces-workflow.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										26
									
								
								.github/workflows/do-spaces-workflow.yml
									
									
									
									
										vendored
									
									
								
							@@ -7,21 +7,23 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
 | 
			
		||||
      - 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 correct Node.js version
 | 
			
		||||
        uses: actions/setup-node@v2
 | 
			
		||||
      - name: Setup Node
 | 
			
		||||
        uses: actions/setup-node@v3.5.0
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: "${{ steps.versions.outputs.NODE }}"
 | 
			
		||||
          node-version-file: ".nvmrc"
 | 
			
		||||
          cache: npm
 | 
			
		||||
 | 
			
		||||
      - name: Use correct NPM version
 | 
			
		||||
        run: npm i -g npm@"${{ steps.versions.outputs.NPM }}"
 | 
			
		||||
      - name: Setup NPM
 | 
			
		||||
        run: |
 | 
			
		||||
          NPM_VERSION=$(jq -r .engines.npm package.json)
 | 
			
		||||
          NPM_VERSION=${NPM_VERSION/\^/}
 | 
			
		||||
          if [ "$(npm --version)" != "$NPM_VERSION" ]; then
 | 
			
		||||
            npm install -g npm@$NPM_VERSION && npm --version
 | 
			
		||||
          else
 | 
			
		||||
            echo "NPM version is same as package.json engines.npm"
 | 
			
		||||
          fi
 | 
			
		||||
 | 
			
		||||
      - name: Install dependencies
 | 
			
		||||
        run: npm ci
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										26
									
								
								.github/workflows/gh-pages-workflow.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										26
									
								
								.github/workflows/gh-pages-workflow.yml
									
									
									
									
										vendored
									
									
								
							@@ -10,21 +10,23 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
 | 
			
		||||
      - 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 correct Node.js version
 | 
			
		||||
        uses: actions/setup-node@v2
 | 
			
		||||
      - name: Setup Node
 | 
			
		||||
        uses: actions/setup-node@v3.5.0
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: "${{ steps.versions.outputs.NODE }}"
 | 
			
		||||
          node-version-file: ".nvmrc"
 | 
			
		||||
          cache: npm
 | 
			
		||||
 | 
			
		||||
      - name: Use correct NPM version
 | 
			
		||||
        run: npm i -g npm@"${{ steps.versions.outputs.NPM }}"
 | 
			
		||||
      - name: Setup NPM
 | 
			
		||||
        run: |
 | 
			
		||||
          NPM_VERSION=$(jq -r .engines.npm package.json)
 | 
			
		||||
          NPM_VERSION=${NPM_VERSION/\^/}
 | 
			
		||||
          if [ "$(npm --version)" != "$NPM_VERSION" ]; then
 | 
			
		||||
            npm install -g npm@$NPM_VERSION && npm --version
 | 
			
		||||
          else
 | 
			
		||||
            echo "NPM version is same as package.json engines.npm"
 | 
			
		||||
          fi
 | 
			
		||||
 | 
			
		||||
      - name: Install dependencies
 | 
			
		||||
        run: npm ci
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										78
									
								
								.github/workflows/test-workflow.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										78
									
								
								.github/workflows/test-workflow.yml
									
									
									
									
										vendored
									
									
								
							@@ -7,21 +7,23 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
 | 
			
		||||
      - 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 correct Node.js version
 | 
			
		||||
        uses: actions/setup-node@v2
 | 
			
		||||
      - name: Setup Node
 | 
			
		||||
        uses: actions/setup-node@v3.5.0
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: "${{ steps.versions.outputs.NODE }}"
 | 
			
		||||
          node-version-file: ".nvmrc"
 | 
			
		||||
          cache: npm
 | 
			
		||||
 | 
			
		||||
      - name: Use correct NPM version
 | 
			
		||||
        run: npm i -g npm@"${{ steps.versions.outputs.NPM }}"
 | 
			
		||||
      - name: Setup NPM
 | 
			
		||||
        run: |
 | 
			
		||||
          NPM_VERSION=$(jq -r .engines.npm package.json)
 | 
			
		||||
          NPM_VERSION=${NPM_VERSION/\^/}
 | 
			
		||||
          if [ "$(npm --version)" != "$NPM_VERSION" ]; then
 | 
			
		||||
            npm install -g npm@$NPM_VERSION && npm --version
 | 
			
		||||
          else
 | 
			
		||||
            echo "NPM version is same as package.json engines.npm"
 | 
			
		||||
          fi
 | 
			
		||||
 | 
			
		||||
      - name: Install dependencies
 | 
			
		||||
        run: npm ci
 | 
			
		||||
@@ -33,21 +35,23 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
 | 
			
		||||
      - 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 correct Node.js version
 | 
			
		||||
        uses: actions/setup-node@v2
 | 
			
		||||
      - name: Setup Node
 | 
			
		||||
        uses: actions/setup-node@v3.5.0
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: "${{ steps.versions.outputs.NODE }}"
 | 
			
		||||
          node-version-file: ".nvmrc"
 | 
			
		||||
          cache: npm
 | 
			
		||||
 | 
			
		||||
      - name: Use correct NPM version
 | 
			
		||||
        run: npm i -g npm@"${{ steps.versions.outputs.NPM }}"
 | 
			
		||||
      - name: Setup NPM
 | 
			
		||||
        run: |
 | 
			
		||||
          NPM_VERSION=$(jq -r .engines.npm package.json)
 | 
			
		||||
          NPM_VERSION=${NPM_VERSION/\^/}
 | 
			
		||||
          if [ "$(npm --version)" != "$NPM_VERSION" ]; then
 | 
			
		||||
            npm install -g npm@$NPM_VERSION && npm --version
 | 
			
		||||
          else
 | 
			
		||||
            echo "NPM version is same as package.json engines.npm"
 | 
			
		||||
          fi
 | 
			
		||||
 | 
			
		||||
      - name: Install dependencies
 | 
			
		||||
        run: npm ci
 | 
			
		||||
@@ -59,21 +63,23 @@ jobs:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
 | 
			
		||||
      - 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 correct Node.js version
 | 
			
		||||
        uses: actions/setup-node@v2
 | 
			
		||||
      - name: Setup Node
 | 
			
		||||
        uses: actions/setup-node@v3.5.0
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: "${{ steps.versions.outputs.NODE }}"
 | 
			
		||||
          node-version-file: ".nvmrc"
 | 
			
		||||
          cache: npm
 | 
			
		||||
 | 
			
		||||
      - name: Use correct NPM version
 | 
			
		||||
        run: npm i -g npm@"${{ steps.versions.outputs.NPM }}"
 | 
			
		||||
      - name: Setup NPM
 | 
			
		||||
        run: |
 | 
			
		||||
          NPM_VERSION=$(jq -r .engines.npm package.json)
 | 
			
		||||
          NPM_VERSION=${NPM_VERSION/\^/}
 | 
			
		||||
          if [ "$(npm --version)" != "$NPM_VERSION" ]; then
 | 
			
		||||
            npm install -g npm@$NPM_VERSION && npm --version
 | 
			
		||||
          else
 | 
			
		||||
            echo "NPM version is same as package.json engines.npm"
 | 
			
		||||
          fi
 | 
			
		||||
 | 
			
		||||
      - name: Install dependencies
 | 
			
		||||
        run: npm ci
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user