-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from chialab/chore/workflows
chore: add workflows
- Loading branch information
Showing
13 changed files
with
258 additions
and
41 deletions.
There are no files selected for viewing
This file contains 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,49 @@ | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
|
||
# Maintain dependencies for print2pdf package | ||
- package-ecosystem: "gomod" | ||
directory: "/print2pdf" | ||
schedule: | ||
interval: "weekly" | ||
groups: | ||
aws: | ||
patterns: ['github.com/aws/*'] | ||
chromedp: | ||
patterns: ['github.com/chromedp/*'] | ||
# Maintain self-dependencies for plain module | ||
- package-ecosystem: "gomod" | ||
directory: "/plain" | ||
schedule: | ||
interval: "weekly" | ||
groups: | ||
chialab: | ||
patterns: ['github.com/chialab/*'] | ||
# Maintain self-dependencies for lambda module | ||
- package-ecosystem: "gomod" | ||
directory: "/lambda" | ||
schedule: | ||
interval: "weekly" | ||
groups: | ||
aws: | ||
patterns: ['github.com/aws/*'] | ||
chialab: | ||
patterns: ['github.com/chialab/*'] | ||
|
||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
groups: | ||
gh-actions: | ||
patterns: ['actions/*'] | ||
docker: | ||
patterns: ['docker/*'] | ||
go-lint: | ||
patterns: ['golangci/*'] | ||
release: | ||
patterns: ['softprops/*'] |
This file contains 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,33 @@ | ||
name: "Go Dependency Submission" | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
go-action-detection: | ||
name: Submit dependencies | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
strategy: | ||
matrix: | ||
module: ['plain', 'lambda'] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
cache-dependency-path: ${{ matrix.module }}/go.sum | ||
go-version-file: ${{ matrix.module }}/go.mod | ||
|
||
- name: Run snapshot action | ||
uses: actions/go-dependency-submission@v2 | ||
with: | ||
go-mod-path: ${{ matrix.module }}/go.mod | ||
go-build-target: ${{ matrix.module }}/main.go |
This file contains 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: Publish GO package | ||
|
||
on: | ||
push: | ||
tags: [ print2pdf/v* ] | ||
|
||
jobs: | ||
publish-package: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
cache-dependency-path: print2pdf/go.sum | ||
go-version-file: print2pdf/go.mod | ||
|
||
- name: Publish package | ||
env: | ||
GOPROXY: proxy.golang.org | ||
TAG: ${{ github.ref_name }} | ||
run: go list -m "github.com/chialab/print2pdf-go/print2pdf@${TAG#print2pdf/}" |
This file contains 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,51 @@ | ||
name: Release binaries | ||
|
||
on: | ||
push: | ||
tags: [ v* ] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
release-binaries: | ||
name: Build and release binaries | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
strategy: | ||
matrix: | ||
module: ['plain', 'lambda'] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
cache-dependency-path: ${{ matrix.module }}/go.sum | ||
go-version-file: ${{ matrix.module }}/go.mod | ||
|
||
- name: Build | ||
env: | ||
CGO_ENABLED: 0 | ||
run: | | ||
GOOS=linux GOARCH=amd64 go build -ldflags '-s' -o build/print2pdf-${{ matrix.module }}-linux-amd64 ${{ matrix.module }} | ||
GOOS=linux GOARCH=arm64 go build -ldflags '-s' -o build/print2pdf-${{ matrix.module }}-linux-arm64 ${{ matrix.module }} | ||
GOOS=darwin GOARCH=amd64 go build -ldflags '-s' -o build/print2pdf-${{ matrix.module }}-darwin-amd64 ${{ matrix.module }} | ||
GOOS=darwin GOARCH=arm64 go build -ldflags '-s' -o build/print2pdf-${{ matrix.module }}-darwin-arm64 ${{ matrix.module }} | ||
GOOS=windows GOARCH=amd64 go build -ldflags '-s' -o build/print2pdf-${{ matrix.module }}-windows-amd64 ${{ matrix.module }} | ||
GOOS=windows GOARCH=arm64 go build -ldflags '-s' -o build/print2pdf-${{ matrix.module }}-windows-arm64 ${{ matrix.module }} | ||
- name: Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
draft: true | ||
generate_release_notes: true | ||
files: | | ||
build/print2pdf-${{ matrix.module }}-linux-amd64 | ||
build/print2pdf-${{ matrix.module }}-linux-arm64 | ||
build/print2pdf-${{ matrix.module }}-darwin-amd64 | ||
build/print2pdf-${{ matrix.module }}-darwin-arm64 | ||
build/print2pdf-${{ matrix.module }}-windows-amd64 | ||
build/print2pdf-${{ matrix.module }}-windows-arm64 |
This file contains 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,55 @@ | ||
name: Release containers | ||
|
||
on: | ||
push: | ||
tags: [ v* ] | ||
|
||
jobs: | ||
release-containers: | ||
name: Build and release containers | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
strategy: | ||
matrix: | ||
module: ['plain', 'lambda'] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
ghcr.io/chialab/print2pdf | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
flavor: | | ||
suffix=-${{ matrix.module }} | ||
- name: Login to GitHub Packages | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ${{ matrix.module }} | ||
file: ${{ matrix.module }}/Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains 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,31 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
lint: | ||
name: Run linter | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
module: ['plain', 'lambda'] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
cache-dependency-path: ${{ matrix.module }}/go.sum | ||
go-version-file: ${{ matrix.module }}/go.mod | ||
|
||
- name: Linter | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: latest | ||
working-directory: ${{ matrix.module }} |
This file contains 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,10 +1,16 @@ | ||
.PHONY: lambda plain | ||
.PHONY: bin-plain bin-lambda docker-plain docker-lambda | ||
|
||
IMAGE_NAME ?= print2pdf | ||
IMAGE_TAG ?= dev | ||
|
||
plain: | ||
bin-plain: | ||
CGO_ENABLED=0 go build -ldflags '-s' -o build/print2pdf-plain plain | ||
|
||
bin-lambda: | ||
CGO_ENABLED=0 go build -ldflags '-s' -o build/print2pdf-lambda lambda | ||
|
||
docker-plain: | ||
docker build -t $(IMAGE_NAME):$(IMAGE_TAG) --file plain/Dockerfile plain/ | ||
|
||
lambda: | ||
docker-lambda: | ||
docker build -t $(IMAGE_NAME):$(IMAGE_TAG) --file lambda/Dockerfile lambda/ |
This file contains 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 @@ | ||
<a href="https://pkg.go.dev/github.com/chialab/print2pdf-go/print2pdf"><img src="https://pkg.go.dev/badge/github.com/chialab/print2pdf-go/print2pdf.svg" alt="Go Reference"></a> |
This file contains 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
This file contains 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
This file contains 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
This file contains 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