forked from vieter-v/vieter
				
			Merge pull request 'Upload artifacts to S3; first attempt at Gitea releases' (#52) from gitea-releases into dev
Reviewed-on: Chewing_Bever/vieter#52main
						commit
						d357f8ebbf
					
				|  | @ -5,26 +5,61 @@ matrix: | |||
|     - linux/arm/v7 | ||||
| 
 | ||||
| # These checks already get performed on the feature branches | ||||
| branches: | ||||
|   exclude: [ main, dev ] | ||||
| platform: ${PLATFORM} | ||||
| 
 | ||||
| pipeline: | ||||
|   # The default build isn't needed, as alpine switches to gcc for the compiler anyways | ||||
|   debug: | ||||
|     image: 'chewingbever/vlang:latest' | ||||
|     pull: true | ||||
|     group: 'build' | ||||
|     commands: | ||||
|       - make debug | ||||
|     when: | ||||
|       event: push | ||||
| 
 | ||||
|   prod: | ||||
|     image: 'chewingbever/vlang:latest' | ||||
|     pull: true | ||||
|     environment: | ||||
|       - LDFLAGS=-lz -lbz2 -llzma -lexpat -lzstd -llz4 -static | ||||
|     group: 'build' | ||||
|     commands: | ||||
|       - make prod | ||||
|       # Make sure the binary is actually static | ||||
|       # Make sure the binary is actually statically built | ||||
|       - readelf -d pvieter | ||||
|       - du -h pvieter | ||||
|       - '[ "$(readelf -d pvieter | grep NEEDED | wc -l)" = 0 ]' | ||||
|       # This removes so much, it's amazing | ||||
|       - strip -s pvieter | ||||
|       - du -h pvieter | ||||
|     when: | ||||
|       event: push | ||||
| 
 | ||||
|   upload: | ||||
|     image: 'alpine:latest' | ||||
|     secrets: [ s3_username, s3_password ] | ||||
|     commands: | ||||
|       # We should just add this to the builder image instead | ||||
|       - apk add curl openssl | ||||
| 
 | ||||
|       # https://gist.github.com/JustinTimperio/7c7115f87b775618637d67ac911e595f | ||||
|       - export URL=s3.rustybever.be | ||||
|       - export OBJ_PATH="/vieter/commits/$CI_COMMIT_SHA/vieter-$(echo '${PLATFORM}' | sed 's:/:-:g')" | ||||
|       - export DATE="$(date -R --utc)" | ||||
|       - export CONTENT_TYPE='application/zstd' | ||||
|       - export SIG_STRING="PUT\n\n$CONTENT_TYPE\n$DATE\n$OBJ_PATH" | ||||
|       - export SIGNATURE=`echo -en $SIG_STRING | openssl sha1 -hmac $S3_PASSWORD -binary | base64` | ||||
| 
 | ||||
|       - > | ||||
|         curl  | ||||
|         --silent | ||||
|         -XPUT | ||||
|         -T pvieter | ||||
|         -H "Host: $URL" | ||||
|         -H "Date: $DATE" | ||||
|         -H "Content-Type: $CONTENT_TYPE" | ||||
|         -H "Authorization: AWS $S3_USERNAME:$SIGNATURE" | ||||
|         https://$URL$OBJ_PATH | ||||
|     when: | ||||
|       event: push | ||||
|  |  | |||
|  | @ -6,12 +6,8 @@ platform: linux/amd64 | |||
| pipeline: | ||||
|   lint: | ||||
|     image: 'chewingbever/vlang:latest' | ||||
|     pull: true | ||||
|     group: lint | ||||
|     commands: | ||||
|       - make lint | ||||
| 
 | ||||
|   vet: | ||||
|     image: 'chewingbever/vlang:latest' | ||||
|     group: lint | ||||
|     commands: | ||||
|       - make vet | ||||
|  |  | |||
|  | @ -0,0 +1,40 @@ | |||
| # Yeah so this only works on tags so we'll worry about this later | ||||
| platform: linux/amd64 | ||||
| branches: main | ||||
| 
 | ||||
| # We need the entire repo in order for the release names to work | ||||
| skip_clone: true | ||||
| 
 | ||||
| pipeline: | ||||
|   prepare: | ||||
|     image: 'chewingbever/vlang:latest' | ||||
|     secrets: [ s3_username, s3_password ] | ||||
|     commands: | ||||
|       - git clone "$CI_REPO_REMOTE" . | ||||
|       - git checkout "$CI_COMMIT_BRANCH" | ||||
|       # Write the title to a file that the plugin can then read | ||||
|       - echo "$(git describe --tags --abbrev=0 2> /dev/null || echo '0.0.0')-$(git rev-list --count ^dev)" > title | ||||
|       - cat title | ||||
|       - wget https://dl.min.io/client/mc/release/linux-amd64/mc | ||||
|       - chmod +x mc | ||||
|       - ./mc alias set s3/ https://s3.rustybever.be "$S3_USERNAME" "$S3_PASSWORD" | ||||
|       - ./mc cp -r "s3/vieter/commits/$CI_COMMIT_SHA" assets | ||||
| 
 | ||||
|   release: | ||||
|     image: 'plugins/gitea-release' | ||||
|     secrets: | ||||
|       - gitea_release_api_key | ||||
|     settings: | ||||
|       base_url: https://git.rustybever.be | ||||
|       files: assets/* | ||||
|       checksums: | ||||
|         - md5 | ||||
|         - sha256 | ||||
|       prerelease: true | ||||
|       # This should get read in as a file | ||||
|       title: title | ||||
|     when: | ||||
|       event: push | ||||
| 
 | ||||
| depends_on: | ||||
|   - build | ||||
		Loading…
	
		Reference in New Issue