forked from sajari/docconv
-
Notifications
You must be signed in to change notification settings - Fork 0
Package apk's with GoReleaser #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kimpepper
wants to merge
7
commits into
main
Choose a base branch
from
goreleaser
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ac3ff3a
Add goreleaser and mise for builds
kimpepper 3b26761
No need to setup go
kimpepper 829d0fa
Delete unused files
kimpepper 7b60952
Bump alpine version
kimpepper 63acb27
Upload apk packages to s3
kimpepper 4d89401
Formatting
kimpepper 8e6f0ed
Make public key a secret too
kimpepper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| name: 🏗️ Build | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: ~ | ||
|
|
||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: 📦 Install Mise | ||
| run: | | ||
| curl https://mise.run | sh | ||
| mise install | ||
|
|
||
| - name: Install dependencies | ||
| run: sudo apt install wv unrtf tidy | ||
|
|
||
| - name: Build | ||
| run: mise build | ||
|
|
||
| - name: Test | ||
| run: mise test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| name: 🚀 Publish Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v?[0-9]+.[0-9]+.[0-9]+(-alpha[0-9]+|-beta[0-9]+)?' | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: 📦 Install Mise | ||
| run: | | ||
| curl https://mise.run | sh | ||
| mise install | ||
|
|
||
| - name: ⚙️ Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
|
|
||
| - name: ⚙️ Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: 🔑 Get signing keys | ||
| run: | | ||
| echo "${{ secrets.SKPR_PRIVATE_KEY }}" > skpr.rsa | ||
| echo "${{ secrets.SKPR_PUBLIC_KEY }}" > skpr.rsa.pub | ||
| chmod 600 skpr.rsa skpr.rsa.pub | ||
|
|
||
| - name: 🚀 Publish Release | ||
| run: mise release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: 🚮 Delete signing key | ||
| if: always() | ||
| run: rm -f skpr.rsa | ||
|
|
||
| - name: 🔑 Configure AWS credentials | ||
| uses: aws-actions/configure-aws-credentials@v5 | ||
| with: | ||
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| aws-region: ${{ secrets.AWS_REGION }} | ||
|
|
||
| - name: 📤 Upload APKs to S3 | ||
| run: | | ||
| VERSION=${GITHUB_TAG} | ||
| aws s3 sync \ | ||
| ./dist/docconv_${VERSION}_linux_arm64.apk \ | ||
| s3://package-skpr-io/docconv/${VERSION}/aarch64/docconv_${VERSION}.apk \ | ||
| --acl public-read \ | ||
| --cache-control "max-age=86400" \ | ||
| --delete | ||
| aws s3 sync \ | ||
| ./dist/docconv_${VERSION}_linux_amd64.apk \ | ||
| s3://package-skpr-io/docconv/${VERSION}/x86_64/docconv_${VERSION}.apk \ | ||
| --acl public-read \ | ||
| --cache-control "max-age=86400" \ | ||
| --delete | ||
| # upload public key for validating repository packages. | ||
| aws s3 cp skpr.rsa.pub s3://package-skpr-io/docconv/skpr.rsa.pub --acl public-read | ||
|
|
||
| - name: ☁️ Invalidate CloudFront Cache | ||
| run: | | ||
| VERSION=${GITHUB_TAG} | ||
| aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT_ID} --paths /docconv/${VERSION}/* /docconv/skpr.rsa.pub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| name: 👨🔧 Build Snapshot Release | ||
|
|
||
| on: | ||
| workflow_dispatch: ~ | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: 📦 Install Mise | ||
| run: | | ||
| curl https://mise.run | sh | ||
| mise install | ||
|
|
||
| - name: ⚙️ Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
|
|
||
| - name: ⚙️ Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: 🚀 Create Snapshot Release | ||
| run: mise snapshot | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,7 @@ | ||
|
|
||
| sajari-convert | ||
| *tests/ | ||
| skpr.rsa | ||
| skpr.rsa.pub | ||
| /dist | ||
| /vendor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| project_name: docconv | ||
|
|
||
| version: 2 | ||
|
|
||
| builds: | ||
| - main: ./docd | ||
| binary: docconv | ||
| ldflags: | ||
| - -extldflags '-static' | ||
| env: | ||
| - CGO_ENABLED=0 | ||
| goos: [ linux ] | ||
| goarch: [ amd64, arm64 ] | ||
|
|
||
| release: | ||
| prerelease: auto | ||
| name_template: "docconv {{.Version}}" | ||
| github: | ||
| owner: skpr | ||
| name: docconv | ||
|
|
||
| nfpms: | ||
| - package_name: docconv | ||
| license: MIT | ||
| maintainer: admin@skpr.com.au | ||
| homepage: https://github.com/skpr/docconv | ||
| description: Fork of https://github.com/sajari/docconv to add additional package formats. | ||
| formats: [ apk ] | ||
| dependencies: | ||
| - tesseract-ocr | ||
| - poppler-utils | ||
| overrides: | ||
| apk: | ||
| dependencies: | ||
| - tesseract-ocr | ||
| - tesseract-ocr-dev | ||
| - poppler-utils | ||
| apk: | ||
| signature: | ||
| key_file: skpr.rsa | ||
|
|
||
| dockers_v2: | ||
| - images: | ||
| - "docker.io/skpr/docconv" | ||
| - "ghcr.io/skpr/docconv" | ||
| tags: | ||
| - "{{ .Version }}" | ||
| - "latest" | ||
| platforms: | ||
| - linux/amd64 | ||
| - linux/arm64 | ||
| build_args: | ||
| ALPINE_VERSION: "3.23" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| [tools] | ||
| go = "1.25" | ||
| "ubi:goreleaser/goreleaser" = "latest" | ||
|
|
||
| [env] | ||
| CGO_ENABLED=0 | ||
| LGFLAGS="-extldflags '-static'" | ||
|
|
||
| [tasks.build] | ||
| description = "Build the application" | ||
| run = ''' | ||
| go build -v -o ./dist/docconv ./docd | ||
| ''' | ||
|
|
||
| [tasks.test] | ||
| description = "Run tests" | ||
| run = "go test -v ./..." | ||
|
|
||
| [tasks.snapshot] | ||
| description = "Create a snapshot release with Goreleaser" | ||
| run = "goreleaser release --snapshot --clean" | ||
|
|
||
| [tasks.release] | ||
| description = "Create a release with Goreleaser" | ||
| run = "goreleaser release --clean" |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,8 @@ | ||
| ARG alpine_version=3.21 | ||
| FROM golang:1.24-alpine${alpine_version} as build | ||
| ARG ALPINE_VERSION=3.23 | ||
| FROM alpine:$ALPINE_VERSION | ||
|
|
||
| RUN apk add make \ | ||
| cmake \ | ||
| gcc \ | ||
| g++ \ | ||
| poppler-utils \ | ||
| wv \ | ||
| lynx \ | ||
| tesseract-ocr-dev | ||
| RUN apk add --no-cache tesseract-ocr tesseract-ocr-dev poppler-utils | ||
|
|
||
| WORKDIR /go/src/code.sajari.com/docconv | ||
| COPY . /go/src/code.sajari.com/docconv | ||
|
|
||
| RUN go build -o dist/docconv -tags ocr code.sajari.com/docconv/docd | ||
|
|
||
| ARG alpine_version=3.21 | ||
| FROM alpine:${alpine_version} | ||
|
|
||
| RUN apk add tesseract-ocr \ | ||
| tesseract-ocr-dev \ | ||
| poppler-utils | ||
|
|
||
| COPY --from=build /go/src/code.sajari.com/docconv/dist/docconv /usr/local/bin/docconv | ||
|
|
||
| ENTRYPOINT ["/usr/local/bin/docconv"] | ||
| ARG TARGETPLATFORM | ||
| COPY $TARGETPLATFORM/docconv /usr/bin/docconv | ||
| ENTRYPOINT ["/usr/bin/docconv"] | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-add this