Skip to content
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

ci: add goreleaser to supercronic #182

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 23 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,29 @@ on:
release:
types: [published]

permissions:
contents: write
packages: write

jobs:
publish:
goreleaser:
runs-on: ubuntu-latest

steps:
- name: install golang
uses: actions/setup-go@v5
with:
go-version: 1.23.1

- name: checkout code
uses: actions/checkout@v4

- name: build assets
run: make release VERSION=${{ github.event.release.tag_name }}

- name: gh login
run: echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token

- name: upload assets to release
run: gh release upload ${{ github.event.release.tag_name }} dist/*
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: 1.23.1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: goreleaser/goreleaser-action@v6
if: success() && startsWith(github.ref, 'refs/tags/')
with:
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
project_name: supercronic

builds:
- env: [CGO_ENABLED=0]
goos:
- linux
- darwin
goarch:
- amd64
- arm64
archives:
- format: binary
kos:
- repository: ghcr.io/aptible/supercronic
tags:
- "{{.Version}}"
- latest
bare: true
preserve_import_paths: false
platforms:
- linux/amd64
- linux/arm64
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,4 @@ vulncheck: build
fmt:
gofmt -l -w ${GOFILES_NOVENDOR}

.PHONY: release
release:
./build.sh ${VERSION}

.DEFAULT_GOAL := test
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

Supercronic is a crontab-compatible job runner, designed specifically to run in
containers.


## Why Supercronic? ##

Expand Down Expand Up @@ -63,15 +63,39 @@ running cron jobs in containers**.

### Download

The easiest way to install Supercronic is to download a pre-built binary.
#### Run in Docker

To run supersonic as a Docker container, you can use the following command:

```bash
docker run -v /path/to/crontab:/etc/crontab -it ghcr.io/aptible/supercronic /etc/crontab
```

#### Include in Dockerfile

To include Supercronic in your Dockerfile, you can use the following:

```Dockerfile
FROM ubuntu:latest

COPY --from=ghcr.io/aptible/supercronic:latest /ko-app/supercronic /usr/local/bin/supercronic

COPY ./path/to/crontab /etc/custom-crontab

ENTRYPOINT ["/usr/local/bin/supercronic", "/etc/custom-crontab"]
```

#### Download the latest release
You can as well download a pre-built binary.

Navigate to [the releases page][releases], and grab the build that suits your
system. The releases include example `Dockerfile` stanzas to install
Supercronic that you can easily include in your own `Dockerfile` or adjust as
needed.

Note: If you are unsure which binary is right for you, try
`supercronic-linux-amd64`.
`supercronic_{{vesion}}_linux_amd64`.


### Build

Expand Down
15 changes: 0 additions & 15 deletions build.sh

This file was deleted.