generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Validate PRs by running build & test * Release Go binaries and images * Create custom images for test purposes
- Loading branch information
Showing
7 changed files
with
226 additions
and
12 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,57 @@ | ||
name: Development | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: {} | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
devel: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Fetch tags | ||
run: git fetch --force --tags | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build devel image | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --clean --snapshot -f .goreleaser-devel.yaml | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Push devel image | ||
env: | ||
IMAGE_NAME: ${{ github.event.repository.name }}-devel | ||
run: | | ||
docker image ls --format "{{.Repository}}:{{.Tag}}" |\ | ||
grep -e "$IMAGE_NAME:.*$(git rev-parse --short HEAD).*" |\ | ||
xargs -I{} docker push {} |
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,50 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
id-token: write | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Fetch tags | ||
run: git fetch --force --tags | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Release binaries & image | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,25 @@ | ||
name: Go Tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "main" | ||
- "rel-*" | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: Build | ||
run: make build | ||
|
||
- name: Tests | ||
run: make test |
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,30 @@ | ||
project_name: remote-work-processor | ||
snapshot: | ||
name_template: "{{ incminor .Version }}-{{ .ShortCommit }}" | ||
builds: | ||
- goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
main: ./cmd/remote-work-processor/main.go | ||
binary: remote-work-processor | ||
ldflags: -s -w -X main.Version={{.Version}} -X main.BuildDate={{.Date}} | ||
env: | ||
- CGO_ENABLED=0 | ||
dockers: | ||
- dockerfile: Dockerfile | ||
image_templates: | ||
- "ghcr.io/sap/{{ .ProjectName }}-devel:{{ .Version }}" | ||
use: buildx | ||
goos: linux | ||
goarch: amd64 | ||
build_flag_templates: | ||
- --platform=linux/amd64 | ||
- --label=org.opencontainers.image.created={{ .Date }} | ||
- --label=org.opencontainers.image.title={{ .ProjectName }}-devel | ||
- --label=org.opencontainers.image.version={{ .ShortCommit }} | ||
- --label=org.opencontainers.image.revision=test-{{ .FullCommit }} | ||
- --label=org.opencontainers.image.description={{ .ProjectName }}-devel {{ .ShortCommit }} | ||
- --label=org.opencontainers.image.source=https://github.com/sap/{{ .ProjectName }} | ||
release: | ||
disable: true |
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,43 @@ | ||
project_name: remote-work-processor | ||
builds: | ||
- goos: | ||
- linux | ||
- darwin | ||
- windows | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
main: ./cmd/remote-work-processor/main.go | ||
binary: remote-work-processor | ||
ldflags: -s -w -X main.Version={{.Version}} -X main.BuildDate={{.Date}} | ||
env: | ||
- CGO_ENABLED=0 | ||
dockers: | ||
- dockerfile: Dockerfile | ||
image_templates: | ||
- "ghcr.io/sap/{{ .ProjectName }}:{{ .Version }}" | ||
- "ghcr.io/sap/{{ .ProjectName }}:{{ .Major }}.{{ .Minor }}" | ||
use: buildx | ||
goos: linux | ||
goarch: amd64 | ||
build_flag_templates: | ||
- --platform=linux/amd64 | ||
- --label=org.opencontainers.image.created={{ .Date }} | ||
- --label=org.opencontainers.image.title={{ .ProjectName }} | ||
- --label=org.opencontainers.image.version={{ .Version }} | ||
- --label=org.opencontainers.image.revision={{ .FullCommit }} | ||
- --label=org.opencontainers.image.description={{ .ProjectName }} {{ .Version }} | ||
- --label=org.opencontainers.image.source=https://github.com/sap/{{ .ProjectName }} | ||
archives: | ||
- format: binary | ||
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" | ||
checksum: | ||
name_template: 'checksums.txt' | ||
changelog: | ||
sort: asc | ||
use: git | ||
release: | ||
footer: | | ||
## Docker Images | ||
- `docker pull ghcr.io/sap/{{.ProjectName}}:{{ .Version }}` |
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