Skip to content

Commit c5be2fe

Browse files
authored
[devbox] Add github action for nightly releases (#2523)
Summary Github action that will create nightly devbox releases. How was it tested? Not sure how to test it other than by running this after the fact. Is this change backwards-compatible? Yes.
1 parent 870d846 commit c5be2fe

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

.github/workflows/release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: release
2+
3+
on:
4+
workflow_dispatch:
5+
releaseType:
6+
description: "Release Type"
7+
required: true
8+
default: "snapshot"
9+
type: choice
10+
options:
11+
- snapshot
12+
# Nightly releases
13+
schedule:
14+
- cron: "45 8 * * 1-5"
15+
16+
permissions:
17+
contents: write
18+
19+
jobs:
20+
release:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v3
25+
with:
26+
fetch-depth: 0 # Needed by goreleaser to browse history.
27+
- name: Set up Go
28+
uses: actions/setup-go@v2
29+
with:
30+
go-version: 1.19
31+
- name: Build with goreleaser
32+
uses: goreleaser/goreleaser-action@v3
33+
with:
34+
distribution: goreleaser
35+
version: latest
36+
args: release --rm-dist --skip-publish --snapshot
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
- name: Determine release tag
40+
run: |
41+
TAG=$(ls dist/*_checksums.txt | cut -d '_' -f 2 | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+-dev')
42+
echo "release_tag=$TAG" >> $GITHUB_ENV
43+
- name: Publish release to GitHub
44+
uses: softprops/action-gh-release@v1
45+
with:
46+
prerelease: true
47+
fail_on_unmatched_files: true
48+
tag_name: ${{ env.release_tag }}
49+
files: |
50+
dist/*_checksums.txt
51+
dist/*.tar.gz

.goreleaser.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
project_name: devbox
2+
before:
3+
hooks:
4+
- go mod tidy
5+
builds:
6+
- main: ./cmd/devbox.go
7+
binary: devbox
8+
mod_timestamp: "{{ .CommitTimestamp }}" # For reproducible builds
9+
ldflags:
10+
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.CommitDate}}
11+
env:
12+
- CGO_ENABLED=0
13+
- GO111MODULE=on
14+
goos:
15+
- linux
16+
- darwin
17+
archives:
18+
- files:
19+
- no-files-will-match-* # Glob that does not match to create archive with only binaries.
20+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{if .Arm}}{{.Arm}}{{end}}"
21+
snapshot:
22+
name_template: '{{ incpatch .Version }}-dev{{ time "20060102" }}'
23+
checksum:
24+
name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt"
25+
algorithm: sha256
26+
release:
27+
prerelease: auto
28+
draft: true
29+
github:
30+
owner: jetpack-io
31+
name: devbox

0 commit comments

Comments
 (0)