Skip to content

Commit

Permalink
chore: nightly builds (#1160)
Browse files Browse the repository at this point in the history
* chore: setup nightly builds, allow for pre-release builds

* chore: done include commit sha in nightly build

* chore: lets try nightly builds again
  • Loading branch information
markphelps authored Nov 25, 2022
1 parent 4e77c61 commit d155a0d
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 22 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Nightly Build
on:
workflow_dispatch:
schedule:
- cron: "30 7 * * *" # daily @ 7:30am UTC ☕️

permissions:
contents: write
packages: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-go@v3
with:
go-version: "1.18"
check-latest: true
cache: true

- uses: arduino/setup-task@v1

- uses: docker/setup-qemu-action@v2

- uses: docker/setup-buildx-action@v2

- name: Install GCC for arm64
run: |
sudo apt-get install gcc-aarch64-linux-gnu
- name: Install Syft
run: |
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
- name: Prepare for release
run: |
task prep
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: "${{ github.repository_owner }}"
password: ${{ secrets.GITHUB_TOKEN }}

- name: GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser-pro
version: latest
args: release --rm-dist --nightly
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ANALYTICS_KEY: ${{ secrets.ANALYTICS_KEY }}
51 changes: 29 additions & 22 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ builds:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc

release:
prerelease: auto # enable rc releases (e.g. v1.0.0-rc.1)

nightly:
# Default is `{{ incpatch .Version }}-{{ .ShortCommit }}-nightly`.
name_template: "{{ incpatch .Version }}-nightly"

sboms:
- artifacts: archive

Expand All @@ -51,8 +58,8 @@ dockers:
use: buildx
goarch: amd64
image_templates:
- "flipt/flipt:{{ .Tag }}-amd64"
- "ghcr.io/flipt-io/flipt:{{ .Tag }}-amd64"
- "{{ if .IsNightly }}flipt/flipt:{{ incpatch .Version }}-nightly-amd64{{ else }}flipt/flipt:{{ .Tag }}-amd64{{ end }}"
- "{{ if .IsNightly }}ghcr.io/flipt-io/flipt:{{ incpatch .Version }}-nightly-amd64{{ else }}ghcr.io/flipt-io/flipt:{{ .Tag }}-amd64{{ end }}"
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand All @@ -65,8 +72,8 @@ dockers:
use: buildx
goarch: arm64
image_templates:
- "flipt/flipt:{{ .Tag }}-arm64"
- "ghcr.io/flipt-io/flipt:{{ .Tag }}-arm64"
- "{{ if .IsNightly }}flipt/flipt:{{ incpatch .Version }}-nightly-arm64{{ else }}flipt/flipt:{{ .Tag }}-arm64{{ end }}"
- "{{ if .IsNightly }}ghcr.io/flipt-io/flipt:{{ incpatch .Version }}-nightly-arm64{{ else }}ghcr.io/flipt-io/flipt:{{ .Tag }}-arm64{{ end }}"
build_flag_templates:
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.created={{.Date}}"
Expand All @@ -76,30 +83,30 @@ dockers:
- config/default.yml

docker_manifests:
- name_template: "flipt/flipt:latest"
- name_template: "{{ if .IsNightly }}flipt/flipt:nightly{{ else }}flipt/flipt:latest{{ end }}"
image_templates:
- "flipt/flipt:{{ .Tag }}-amd64"
- "flipt/flipt:{{ .Tag }}-arm64"
- name_template: "flipt/flipt:{{ .Tag }}"
- "{{ if .IsNightly }}flipt/flipt:{{ incpatch .Version }}-nightly-arm64{{ else }}flipt/flipt:{{ .Tag }}-amd64{{ end }}"
- "{{ if .IsNightly }}flipt/flipt:{{ incpatch .Version }}-nightly-arm64{{ else }}flipt/flipt:{{ .Tag }}-arm64{{ end }}"
- name_template: "{{ if .IsNightly }}flipt/flipt:{{ incpatch .Version }}-nightly{{ else }}flipt/flipt:{{ .Tag }}{{ end }}"
image_templates:
- "flipt/flipt:{{ .Tag }}-amd64"
- "flipt/flipt:{{ .Tag }}-arm64"
- name_template: "markphelps/flipt:latest" # TODO: deprecate
- "{{ if .IsNightly }}flipt/flipt:{{ incpatch .Version }}-nightly-arm64{{ else }}flipt/flipt:{{ .Tag }}-amd64{{ end }}"
- "{{ if .IsNightly }}flipt/flipt:{{ incpatch .Version }}-nightly-arm64{{ else }}flipt/flipt:{{ .Tag }}-arm64{{ end }}"
- name_template: "{{ if .IsNightly }}markphelps/flipt:nightly{{ else }}markphelps/flipt:latest{{ end }}" # TODO: deprecate
image_templates:
- "flipt/flipt:{{ .Tag }}-amd64"
- "flipt/flipt:{{ .Tag }}-arm64"
- name_template: "markphelps/flipt:{{ .Tag }}" # TODO: deprecate
- "{{ if .IsNightly }}flipt/flipt:{{ incpatch .Version }}-nightly-arm64{{ else }}flipt/flipt:{{ .Tag }}-amd64{{ end }}"
- "{{ if .IsNightly }}flipt/flipt:{{ incpatch .Version }}-nightly-arm64{{ else }}flipt/flipt:{{ .Tag }}-arm64{{ end }}"
- name_template: "{{ if .IsNightly }}markphelps/flipt:{{ incpatch .Version }}-nightly{{ else }}markphelps/flipt:{{ .Tag }}{{ end }}" # TODO: deprecate
image_templates:
- "flipt/flipt:{{ .Tag }}-amd64"
- "flipt/flipt:{{ .Tag }}-arm64"
- name_template: "ghcr.io/flipt-io/flipt:latest"
- "{{ if .IsNightly }}flipt/flipt:{{ incpatch .Version }}-nightly-arm64{{ else }}flipt/flipt:{{ .Tag }}-amd64{{ end }}"
- "{{ if .IsNightly }}flipt/flipt:{{ incpatch .Version }}-nightly-arm64{{ else }}flipt/flipt:{{ .Tag }}-arm64{{ end }}"
- name_template: "{{ if .IsNightly }}ghcr.io/flipt-io/flipt:nightly{{ else }}ghcr.io/flipt-io/flipt:latest{{ end }}"
image_templates:
- "ghcr.io/flipt-io/flipt:{{ .Tag }}-amd64"
- "ghcr.io/flipt-io/flipt:{{ .Tag }}-arm64"
- name_template: "ghcr.io/flipt-io/flipt:{{ .Tag }}"
- "{{ if .IsNightly }}ghcr.io/flipt-io/flipt:{{ incpatch .Version }}-nightly-arm64{{ else }}ghcr.io/flipt-io/flipt:{{ .Tag }}-amd64{{ end }}"
- "{{ if .IsNightly }}ghcr.io/flipt-io/flipt:{{ incpatch .Version }}-nightly-arm64{{ else }}ghcr.io/flipt-io/flipt:{{ .Tag }}-arm64{{ end }}"
- name_template: "{{ if .IsNightly }}ghcr.io/flipt-io/flipt:{{ incpatch .Version }}-nightly{{ else }}ghcr.io/flipt-io/flipt:{{ .Tag }}{{ end }}"
image_templates:
- "ghcr.io/flipt-io/flipt:{{ .Tag }}-amd64"
- "ghcr.io/flipt-io/flipt:{{ .Tag }}-arm64"
- "{{ if .IsNightly }}ghcr.io/flipt-io/flipt:{{ incpatch .Version }}-nightly-arm64{{ else }}ghcr.io/flipt-io/flipt:{{ .Tag }}-amd64{{ end }}"
- "{{ if .IsNightly }}ghcr.io/flipt-io/flipt:{{ incpatch .Version }}-nightly-arm64{{ else }}ghcr.io/flipt-io/flipt:{{ .Tag }}-arm64{{ end }}"

announce:
discord:
Expand Down

0 comments on commit d155a0d

Please sign in to comment.