diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000000..4cca94f56b --- /dev/null +++ b/.github/workflows/nightly.yml @@ -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 }} diff --git a/.goreleaser.yml b/.goreleaser.yml index a4789f292a..255075fa8b 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -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 @@ -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}}" @@ -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}}" @@ -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: