mirror of
				https://github.com/nitnelave/lldap.git
				synced 2023-04-12 14:25:13 +00:00 
			
		
		
		
	release-tools: Add docker flow and release preparation script
This commit is contained in:
		
							parent
							
								
									51f95d5a63
								
							
						
					
					
						commit
						af2abd61fb
					
				
							
								
								
									
										63
									
								
								.github/workflows/docker.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								.github/workflows/docker.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,63 @@
 | 
				
			|||||||
 | 
					name: ci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					    tags:
 | 
				
			||||||
 | 
					      - 'v*.*.*'
 | 
				
			||||||
 | 
					  pull_request:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - 'main'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  docker:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Checkout
 | 
				
			||||||
 | 
					        uses: actions/checkout@v2
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Docker meta
 | 
				
			||||||
 | 
					        id: meta
 | 
				
			||||||
 | 
					        uses: docker/metadata-action@v3
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          # list of Docker images to use as base name for tags
 | 
				
			||||||
 | 
					          images: |
 | 
				
			||||||
 | 
					            nitnelave/lldap
 | 
				
			||||||
 | 
					          # generate Docker tags based on the following events/attributes
 | 
				
			||||||
 | 
					          tags: |
 | 
				
			||||||
 | 
					            type=ref,event=branch
 | 
				
			||||||
 | 
					            type=ref,event=pr
 | 
				
			||||||
 | 
					            type=semver,pattern={{version}}
 | 
				
			||||||
 | 
					            type=semver,pattern={{major}}.{{minor}}
 | 
				
			||||||
 | 
					            type=semver,pattern={{major}}
 | 
				
			||||||
 | 
					            type=sha
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Set up Docker Buildx
 | 
				
			||||||
 | 
					        uses: docker/setup-buildx-action@v1
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Login to DockerHub
 | 
				
			||||||
 | 
					        if: github.event_name != 'pull_request'
 | 
				
			||||||
 | 
					        uses: docker/login-action@v1
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          username: ${{ secrets.DOCKERHUB_USERNAME }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.DOCKERHUB_TOKEN }}
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Build and push
 | 
				
			||||||
 | 
					        uses: docker/build-push-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          context: .
 | 
				
			||||||
 | 
					          push: ${{ github.event_name != 'pull_request' }}
 | 
				
			||||||
 | 
					          platforms: linux/amd64
 | 
				
			||||||
 | 
					          tags: nitnelave/lldap:latest
 | 
				
			||||||
 | 
					          cache-from: type=gha
 | 
				
			||||||
 | 
					          cache-to: type=gha,mode=max
 | 
				
			||||||
 | 
					      -
 | 
				
			||||||
 | 
					        name: Update repo description
 | 
				
			||||||
 | 
					        if: github.event_name != 'pull_request'
 | 
				
			||||||
 | 
					        uses: peter-evans/dockerhub-description@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          username: ${{ secrets.DOCKERHUB_USERNAME }}
 | 
				
			||||||
 | 
					          password: ${{ secrets.DOCKERHUB_PASSWORD }}
 | 
				
			||||||
 | 
					          repository: nitnelave/lldap
 | 
				
			||||||
							
								
								
									
										25
									
								
								prepare-release.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										25
									
								
								prepare-release.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					#! /bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set -e
 | 
				
			||||||
 | 
					set -x
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Build the binary server, for x86_64.
 | 
				
			||||||
 | 
					cargo build --release -p lldap
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cargo install cross
 | 
				
			||||||
 | 
					cross build --target=armv7-unknown-linux-musleabihf -p lldap --release
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Build the frontend.
 | 
				
			||||||
 | 
					./app/build.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					VERSION=$(git describe --tags)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					mkdir -p /tmp/release/x86_64
 | 
				
			||||||
 | 
					cp target/release/lldap /tmp/release/x86_64
 | 
				
			||||||
 | 
					cp -R app/index.html app/main.js app/pkg lldap_config.docker_template.toml README.md LICENSE /tmp/release/x86_64
 | 
				
			||||||
 | 
					tar -czvf lldap-x86_64-${VERSION}.tar.gz /tmp/release/x86_64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					mkdir -p /tmp/release/armv7
 | 
				
			||||||
 | 
					cp target/armv7-unknown-linux-musleabihf/release/lldap /tmp/release/armv7
 | 
				
			||||||
 | 
					cp -R app/index.html app/main.js app/pkg lldap_config.docker_template.toml README.md LICENSE /tmp/release/armv7
 | 
				
			||||||
 | 
					tar -czvf lldap-armv7-${VERSION}.tar.gz /tmp/release/armv7
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user