Skip to content

Commit

Permalink
Tweak action [ci skip]
Browse files Browse the repository at this point in the history
Signed-off-by: Neil Twigg <neil@nats.io>
  • Loading branch information
neilalexander committed Jan 29, 2025
1 parent 90fc71b commit bd540e2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 39 deletions.
32 changes: 6 additions & 26 deletions .github/actions/nightly-release/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ name: Nightly Docker Releaser
description: Builds nightly docker images

inputs:
go:
description: The version of go to build with
required: true

label:
description: The label to use for built images
required: false
default: nightly

hub_username:
description: Docker hub username
required: true
Expand All @@ -26,31 +17,20 @@ inputs:
runs:
using: composite
steps:
- name: Log in to Docker Hub
shell: bash
run: docker login -u "${{ inputs.hub_username }}" -p "${{ inputs.hub_password }}"

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "${{ inputs.go }}"
go-version: "stable"

- name: goreleaser
- name: Build and push Docker images
# Use commit hash here to avoid a re-tagging attack, as this is a third-party action
# Commit 5742e2a039330cbb23ebf35f046f814d4c6ff811 = tag v5
uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811
with:
workdir: "${{ inputs.workdir }}"
version: latest
args: release --snapshot --config .goreleaser-nightly.yml

- name: images
shell: bash
run: docker images

- name: docker_login
shell: bash
run: docker login -u "${{ inputs.hub_username }}" -p "${{ inputs.hub_password }}"

- name: docker_push
shell: bash
run: |
NDATE=$(date +%Y%m%d)
docker push synadia/nats-server:${{ inputs.label }}-${NDATE}
docker push synadia/nats-server:${{ inputs.label }}
9 changes: 1 addition & 8 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@ on:
workflow_dispatch:
inputs:
target:
description: "Override image branch (optional)"
description: "Override source branch (optional)"
type: string
required: false
label:
description: "Override tag label (optional)"
type: string
required: false
default: "nightly"

schedule:
- cron: "40 4 * * *"
Expand All @@ -27,8 +22,6 @@ jobs:

- uses: ./src/github.com/nats-io/nats-server/.github/actions/nightly-release
with:
go: "stable"
workdir: src/github.com/nats-io/nats-server
label: ${{ inputs.label }}
hub_username: "${{ secrets.DOCKER_USERNAME }}"
hub_password: "${{ secrets.DOCKER_PASSWORD }}"
9 changes: 4 additions & 5 deletions .goreleaser-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ builds:
dockers:
- goos: linux
goarch: amd64
skip_push: true
dockerfile: docker/Dockerfile.nightly
build_flag_templates:
- '--build-arg=VERSION={{ if index .Env "IMAGE_NAME" }}{{ .Env.IMAGE_NAME }}{{ else if not (eq .Branch "main" "dev" "") }}{{ replace .Branch "/" "-" }}{{ else }}nightly{{ end }}-{{ time "20060102" }}'
- '--build-arg=VERSION={{ if ne .Branch "main" "" }}{{ replace .Branch "/" "-" }}{{ else }}nightly{{ end }}-{{ time "20060102" }}'
image_templates:
- synadia/nats-server:{{.Version}}
- synadia/nats-server:{{ if index .Env "IMAGE_NAME" }}{{ .Env.IMAGE_NAME }}{{ else if not (eq .Branch "main" "dev" "") }}{{ replace .Branch "/" "-" }}{{ else }}nightly{{ end }}
- synadia/nats-server:{{ if ne .Branch "main" "" }}{{ replace .Branch "/" "-" }}{{ else }}nightly{{ end }}
- synadia/nats-server:{{ if ne .Branch "main" "" }}{{ replace .Branch "/" "-" }}{{ else }}nightly{{ end }}-{{ time "20060102" }}
extra_files:
- docker/nats-server.conf

Expand All @@ -32,4 +31,4 @@ checksum:
algorithm: sha256

snapshot:
name_template: '{{ if index .Env "IMAGE_NAME" }}{{ .Env.IMAGE_NAME }}{{ else if not (eq .Branch "main" "dev" "") }}{{ replace .Branch "/" "-" }}{{ else }}nightly{{ end }}-{{ time "20060102" }}'
name_template: '{{ if ne .Branch "main" "" }}{{ replace .Branch "/" "-" }}{{ else }}nightly{{ end }}-{{ time "20060102" }}'

0 comments on commit bd540e2

Please sign in to comment.