Skip to content

Commit

Permalink
Add action to automate release
Browse files Browse the repository at this point in the history
Closes: #2356
Signed-off-by: Michael Gasch <mgasch@vmware.com>
  • Loading branch information
Michael Gasch committed Apr 14, 2021
1 parent 9af2307 commit 3385b3e
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 6 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/govmomi-build.yaml
Expand Up @@ -29,22 +29,30 @@ jobs:
artifacts:
name: Build Snapshot Release (no upload)
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 15

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: GoReleaser Snapshot

- name: Docker Login (verify only)
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build Artifacts
uses: goreleaser/goreleaser-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: latest
args: release --rm-dist --snapshot # snapshot will disable push/release

- name: Verify git clean
shell: bash
run: |
Expand All @@ -55,6 +63,7 @@ jobs:
echo "::error:: $(git status)"
exit 1
fi
# make artifacts available for inspection
# https://docs.github.com/en/actions/guides/storing-workflow-data-as-artifacts
- name: Archive run artifacts
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/govmomi-release.yaml
@@ -0,0 +1,48 @@
# Copyright (c) 2021 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Release

on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v0.25.0, v1.15.1

jobs:
artifacts:
name: Create Release
runs-on: ubuntu-latest
timeout-minutes: 60

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Docker Login
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push Artifacts
uses: goreleaser/goreleaser-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: latest
args: release --rm-dist # will push artefacts and container images
17 changes: 13 additions & 4 deletions .goreleaser.yml
@@ -1,5 +1,9 @@
---
project_name: govmomi
before:
hooks:
- go mod vendor

builds:
- id: govc
goos: &goos-defs
Expand Down Expand Up @@ -32,6 +36,7 @@ builds:
binary: vcsim
ldflags:
- "-X main.buildVersion={{.Version}} -X main.buildCommit={{.ShortCommit}} -X main.buildDate={{.Date}}"

archives:
- id: govcbuild
builds:
Expand All @@ -43,21 +48,22 @@ archives:
windows: Windows
freebsd: FreeBSD
amd64: x86_64
format_overrides:
format_overrides: &overrides
- goos: windows
format: zip
- id: vcsimbuild
builds:
- vcsim
name_template: "vcsim_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
replacements: *replacements
format_overrides:
- goos: windows
format: zip
format_overrides: *overrides

snapshot:
name_template: "{{ .Tag }}-next"

checksum:
name_template: "checksums.txt"

changelog:
sort: asc
filters:
Expand All @@ -66,6 +72,8 @@ changelog:
- "^test:"
- Merge pull request
- Merge branch

# upload disabled since it is maintained in homebrew-core
brews:
- name: govc
ids:
Expand Down Expand Up @@ -107,6 +115,7 @@ brews:
system "#{bin}/vcsim -h"
install: |
bin.install "vcsim"
dockers:
- image_templates:
- "vmware/govc:{{ .Tag }}"
Expand Down

0 comments on commit 3385b3e

Please sign in to comment.