Skip to content

Commit

Permalink
add apt repo build
Browse files Browse the repository at this point in the history
  • Loading branch information
reddec committed Dec 29, 2023
1 parent 11c268d commit 9d824a7
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 53 deletions.
26 changes: 19 additions & 7 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@ jobs:

- name: Pull tag
run: git fetch --tags
- name: Build doc
run: |
python3 assemble_md.py ./docs --exclude ./docs/vendor ./docs/.bundle ./docs/.jekyll-cache ./docs/_site > MANUAL.md
pandoc MANUAL.md -s -t man -o trusted-cgi.1
pandoc --metadata title="Trusted-CGI manual" MANUAL.md -s --include-in-header=./docs/assets/github-pandoc.css --toc -o MANUAL.html
gzip trusted-cgi.1

- uses: docker/login-action@v3
with:
username: 'reddec'
Expand All @@ -48,4 +43,21 @@ jobs:
version: latest
args: release --clean --release-footer _footer.md --release-header release-note.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UPLOAD_PRODUCTION_USERNAME: ${{ secrets.UPLOAD_PRODUCTION_USERNAME }}
UPLOAD_PRODUCTION_SECRET: ${{ secrets.UPLOAD_PRODUCTION_SECRET }}

- name: Notify APT
run: |
PROJECT="$(cat dist/metadata.json | jq -r .project_name)"
# re-index
curl -X POST -H 'Content-Type: application/json' -u "${UPLOAD_PRODUCTION_USERNAME}:${UPLOAD_PRODUCTION_SECRET}" \
"https://apt.reddec.net/api/repos/reddec/file/${PROJECT}"
# publish
curl -X POST --keepalive-time 10 --max-time 240 -H 'Content-Type: application/json' -u "${UPLOAD_PRODUCTION_USERNAME}:${UPLOAD_PRODUCTION_SECRET}" \
--data '{"SourceKind": "local", "Sources": [{"Name":"reddec"}]}' \
https://apt.reddec.net/api/publish/s3:r2:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }
UPLOAD_PRODUCTION_USERNAME: ${{ secrets.UPLOAD_PRODUCTION_USERNAME }}
UPLOAD_PRODUCTION_SECRET: ${{ secrets.UPLOAD_PRODUCTION_SECRET }}
97 changes: 51 additions & 46 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,36 @@ before:
- gzip -f trusted-cgi.1

builds:
- main: ./cmd/trusted-cgi/main.go
id: server
binary: trusted-cgi
env:
- CGO_ENABLED=0
goarch:
- amd64
- arm
- arm64
goos:
- linux
- windows
- darwin
flags:
- -trimpath
- main: ./cmd/cgi-ctl
id: client
binary: cgi-ctl
env:
- CGO_ENABLED=0
goarch:
- amd64
- arm
- arm64
goos:
- linux
- windows
- darwin
flags:
- -trimpath
- main: ./cmd/trusted-cgi/main.go
id: server
binary: trusted-cgi
env:
- CGO_ENABLED=0
goarch:
- amd64
- arm
- arm64
goos:
- linux
- windows
- darwin
flags:
- -trimpath
- main: ./cmd/cgi-ctl
id: client
binary: cgi-ctl
env:
- CGO_ENABLED=0
goarch:
- amd64
- arm
- arm64
goos:
- linux
- windows
- darwin
flags:
- -trimpath
nfpms:
- id: debian
package_name: "trusted-cgi"
Expand All @@ -56,7 +56,7 @@ nfpms:
file_name_template: "{{ .ProjectName }}-server_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
homepage: https://github.com/reddec/trusted-cgi
maintainer: Baryshnikov Aleksandr <owner@reddec.net>
description: Lightweigt runner for lambda functions/apps in CGI like mode
description: Lightweigt runner for lambda functions/apps in CGI like mode
license: MIT
builds:
- server
Expand Down Expand Up @@ -99,16 +99,17 @@ nfpms:
builds:
- client
archives:
- name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
files:
- LICENSE
- README.md
- MANUAL.md
- MANUAL.html
format: tar.gz
format_overrides:
- goos: windows
format: zip
- name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
files:
- LICENSE
- README.md
- MANUAL.md
- MANUAL.html
format: tar.gz
format_overrides:
- goos: windows
format: zip

dockers:
# build full images for ARM and AMD64
- image_templates:
Expand Down Expand Up @@ -186,12 +187,16 @@ docker_manifests:
image_templates:
- "reddec/trusted-cgi:v{{ .Major }}.{{ .Minor }}-light-amd64"
- "reddec/trusted-cgi:v{{ .Major }}.{{ .Minor }}-light-arm64v8"
uploads:
publishers:
- name: production
method: POST
exts:
- deb
target: "https://apt.reddec.net/api/files/{{ .ProjectName }}"
ids:
- debian
- debian-server
- debian-client
checksum: false
signature: false
cmd: "curl -X POST -u '{{.Env.UPLOAD_PRODUCTION_USERNAME}}:{{.Env.UPLOAD_PRODUCTION_SECRET}}' -F file=@{{.ArtifactPath}} https://apt.reddec.net/api/files/{{ .ProjectName }}"

checksum:
name_template: 'checksums.txt'
snapshot:
Expand Down

0 comments on commit 9d824a7

Please sign in to comment.