feat: inital commit
This commit is contained in:
		
						commit
						a1dfd09c11
					
				
					 3 changed files with 50 additions and 0 deletions
				
			
		
							
								
								
									
										6
									
								
								.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | |||
| __test__/_temp | ||||
| _temp/ | ||||
| lib/ | ||||
| node_modules/ | ||||
| .vscode/ | ||||
| .idea/ | ||||
							
								
								
									
										12
									
								
								README.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								README.md
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| # Maven Cache V1 | ||||
| 
 | ||||
| This is a more advanced maven cache action. | ||||
| 
 | ||||
| ## Usage | ||||
| 
 | ||||
| ``` | ||||
| - name: Cache Maven repository | ||||
|   uses: https://git.kvant.cloud/actions/maven-cache@v1 | ||||
|   with: | ||||
|     root-cache-key: 'm2-cache-project-name' # this should be unique | ||||
| ``` | ||||
							
								
								
									
										32
									
								
								action.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								action.yml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,32 @@ | |||
| name: 'Maven Cache' | ||||
| description: 'The .m2/repository caching mechanism' | ||||
| 
 | ||||
| inputs: | ||||
|   root-cache-key: | ||||
|     description: 'The unique root key for the cache. For example `m2-cache-project-name`.' | ||||
|     required: true | ||||
| 
 | ||||
| runs: | ||||
|   using: 'composite' | ||||
|   steps: | ||||
|     - name: Generate cache keys | ||||
|       id: generate-cache-keys | ||||
|       shell: bash | ||||
|       run: | | ||||
|         CURRENT_BRANCH="${{ github.head_ref || github.ref_name }}" | ||||
|         CURRENT_MONTH=$(/bin/date -u "+%Y-%m") | ||||
|         CURRENT_DAY=$(/bin/date -u "+%d") | ||||
|         echo "m2-monthly-cache-key=${{ inputs.root-cache-key }}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT | ||||
|         echo "m2-monthly-branch-cache-key=${{ inputs.root-cache-key }}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT | ||||
|         echo "m2-cache-key=${{ inputs.root-cache-key }}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT | ||||
| 
 | ||||
|     - name: Cache Maven repository | ||||
|       id: cache-maven-repository | ||||
|       uses: actions/cache@v4 | ||||
|       with: | ||||
|         path: ~/.m2/repository | ||||
|         # The cache is per branch but in case we don't find a branch for a given branch, we will get a cache from another branch. | ||||
|         key: ${{ steps.generate-cache-keys.outputs.m2-cache-key }} | ||||
|         restore-keys: | | ||||
|           ${{ steps.generate-cache-keys.outputs.m2-monthly-branch-cache-key }} | ||||
|           ${{ steps.generate-cache-keys.outputs.m2-monthly-cache-key }} | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue