avoid broken cache - use package system
This commit is contained in:
		
							parent
							
								
									492f7d12e7
								
							
						
					
					
						commit
						80e4a90d04
					
				
					 1 changed files with 19 additions and 24 deletions
				
			
		| 
						 | 
					@ -18,21 +18,24 @@ jobs:
 | 
				
			||||||
      - name: Checkout upstream
 | 
					      - name: Checkout upstream
 | 
				
			||||||
        run: |
 | 
					        run: |
 | 
				
			||||||
          git clone --depth=1 https://git.sr.ht/~bptato/chawan
 | 
					          git clone --depth=1 https://git.sr.ht/~bptato/chawan
 | 
				
			||||||
      - name: Upstream version
 | 
					      - name: Get parameters
 | 
				
			||||||
        id: upstream-version
 | 
					        id: vars
 | 
				
			||||||
        run: |
 | 
					        run: |
 | 
				
			||||||
          echo "version=$(git rev-parse HEAD)/$(cd chawan && git rev-parse HEAD)" >> $GITHUB_OUTPUT
 | 
					          echo "upstream=$(cd chawan && git rev-parse HEAD)" | tee -a $GITHUB_OUTPUT
 | 
				
			||||||
          echo "shorthash=$(cd chawan && git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
 | 
					          echo "shorthash=$(cd chawan && git rev-parse --short HEAD)" | tee -a $GITHUB_OUTPUT
 | 
				
			||||||
      - name: Check for pre-existing build
 | 
					          echo "imagename=Chawan-x86_64-$(cd chawan && git rev-parse --short HEAD).AppImage" | tee -a $GITHUB_OUTPUT
 | 
				
			||||||
        id: cache
 | 
					          echo "packageurl=https://git.lerch.org/api/packages/lobo/generic/chawan-appimage/$(git rev-parse --short HEAD)/Chawan-x86_64-$(cd chawan && git rev-parse --short HEAD).AppImage" | tee -a $GITHUB_OUTPUT
 | 
				
			||||||
        uses: actions/cache/restore@v4
 | 
					      - name: Check for built package
 | 
				
			||||||
        with:
 | 
					        id: package
 | 
				
			||||||
          lookup-only: true
 | 
					        run: |
 | 
				
			||||||
          key: ${{ steps.upstream-version.outputs.version }}
 | 
					          if [ $(curl -s -o /dev/null -w "%{http_code}" ${{ steps.vars.outputs.packageurl }}) = 200 ]; then
 | 
				
			||||||
          path: Chawan-x86_64-${{ steps.upstream-version.outputs.shorthash }}.AppImage"
 | 
					            echo "built=true" | tee -a $GITHUB_OUTPUT
 | 
				
			||||||
 | 
					          else
 | 
				
			||||||
 | 
					            echo "built=false" | tee -a $GITHUB_OUTPUT
 | 
				
			||||||
 | 
					          fi
 | 
				
			||||||
      - name: Build AppImage
 | 
					      - name: Build AppImage
 | 
				
			||||||
        id: build
 | 
					        id: build
 | 
				
			||||||
        if: steps.cache.outputs.cache-hit != 'true'
 | 
					        if: steps.package.outputs.built != 'true'
 | 
				
			||||||
        run: |
 | 
					        run: |
 | 
				
			||||||
          apt-get update
 | 
					          apt-get update
 | 
				
			||||||
          apt-get install -y --no-install-recommends \
 | 
					          apt-get install -y --no-install-recommends \
 | 
				
			||||||
| 
						 | 
					@ -70,21 +73,13 @@ jobs:
 | 
				
			||||||
          cd ../..
 | 
					          cd ../..
 | 
				
			||||||
          appimagetool chawan/AppDir
 | 
					          appimagetool chawan/AppDir
 | 
				
			||||||
          mv Chawan-x86_64.AppImage "Chawan-x86_64-$(cd chawan && git rev-parse --short HEAD).AppImage"
 | 
					          mv Chawan-x86_64.AppImage "Chawan-x86_64-$(cd chawan && git rev-parse --short HEAD).AppImage"
 | 
				
			||||||
          echo "filename=Chawan-x86_64-$(cd chawan && git rev-parse --short HEAD).AppImage" >> $GITHUB_OUTPUT
 | 
					          echo "filename=Chawan-x86_64-$(cd chawan && git rev-parse --short HEAD).AppImage" | tee -a $GITHUB_OUTPUT
 | 
				
			||||||
          echo "chawan-version=$(cd chawan && git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
 | 
					 | 
				
			||||||
      - name: Publish AppImage
 | 
					      - name: Publish AppImage
 | 
				
			||||||
        if: steps.cache.outputs.cache-hit != 'true'
 | 
					        if: steps.package.outputs.built != 'true'
 | 
				
			||||||
        run: |
 | 
					        run: |
 | 
				
			||||||
          curl --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \
 | 
					          curl -s --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \
 | 
				
			||||||
            --upload-file ${{ steps.build.outputs.filename }} \
 | 
					            --upload-file ${{ steps.build.outputs.filename }} \
 | 
				
			||||||
            https://git.lerch.org/api/packages/lobo/generic/chawan-appimage/${{ steps.build.outputs.chawan-version }}/${{ steps.build.outputs.filename }}
 | 
					            ${{ steps.vars.outputs.packageurl }}
 | 
				
			||||||
      - name: Save build
 | 
					 | 
				
			||||||
        if: steps.cache.outputs.cache-hit != 'true'
 | 
					 | 
				
			||||||
        uses: actions/cache/save@v4
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          path: |
 | 
					 | 
				
			||||||
            ${{ steps.build.outputs.filename }}
 | 
					 | 
				
			||||||
          key: ${{ steps.cache.outputs.cache-primary-key }}
 | 
					 | 
				
			||||||
      - name: Notify
 | 
					      - name: Notify
 | 
				
			||||||
        uses: https://git.lerch.org/lobo/action-notify-ntfy@v2
 | 
					        uses: https://git.lerch.org/lobo/action-notify-ntfy@v2
 | 
				
			||||||
        if: failure()
 | 
					        if: failure()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue