Skip to content

Commit

Permalink
Merge pull request #6109 from blackpiglet/modify_goreleaser
Browse files Browse the repository at this point in the history
Fix goreleaser issues and add new goreleaser action.
  • Loading branch information
Daniel Jiang committed Apr 18, 2023
2 parents 6b67504 + e779cd2 commit 14f31ee
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 10 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/pr-goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Verify goreleaser change

on:
pull_request:
branches:
- 'main'
- 'release-**'
paths:
- '.goreleaser.yml'
- 'hack/release-tools/goreleaser.sh'

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout

- name: Verify .goreleaser.yml and try a dryrun release.
if: github.repository == 'vmware-tanzu/velero'
run: |
CHANGELOG=$(ls changelogs | sort -V -r | head -n 1)
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
REGISTRY=velero \
RELEASE_NOTES_FILE=changelogs/$CHANGELOG \
PUBLISH=false \
make release
10 changes: 10 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ archives:
files:
- LICENSE
- examples/**/*
# Add the setting to resolve the DEPRECATED warning. Actually, Velero's case is not affected by the rlcp behavior change.
# https://github.com/orgs/goreleaser/discussions/3659#discussioncomment-4587257
rlcp: true
checksum:
name_template: 'CHECKSUM'
release:
Expand All @@ -54,3 +57,10 @@ release:
name: velero
draft: true
prerelease: auto

git:
# What should be used to sort tags when gathering the current and previous
# tags if there are more than one tag in the same commit.
#
# Default: `-version:refname`
tag_sort: -version:creatordate
1 change: 1 addition & 0 deletions changelogs/unreleased/6109-blackpiglet
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix the goreleaser issues and add a new goreleaser action
2 changes: 1 addition & 1 deletion hack/build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ RUN wget --quiet https://github.com/protocolbuffers/protobuf/releases/download/v
RUN go install github.com/golang/protobuf/protoc-gen-go@v1.4.3

# get goreleaser
RUN wget --quiet https://github.com/goreleaser/goreleaser/releases/download/v1.12.3/goreleaser_Linux_x86_64.tar.gz && \
RUN wget --quiet https://github.com/goreleaser/goreleaser/releases/download/v1.15.2/goreleaser_Linux_x86_64.tar.gz && \
tar xvf goreleaser_Linux_x86_64.tar.gz && \
mv goreleaser /usr/bin/goreleaser && \
chmod +x /usr/bin/goreleaser
Expand Down
8 changes: 5 additions & 3 deletions hack/release-tools/goreleaser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,21 @@ else
export GIT_TREE_STATE=dirty
fi

# Verify .goreleaser.yml format first.
echo "Start to verify .goreleaser.yml format"
goreleaser check

# $PUBLISH must explicitly be set to 'TRUE' for goreleaser
# to publish the release to GitHub.
if [[ "${PUBLISH:-}" != "TRUE" ]]; then
echo "Not set to publish"
goreleaser release \
--clean \
--release-notes="${RELEASE_NOTES_FILE}" \
--skip-publish \
--config goreleaser.yaml
--snapshot # Generate an unversioned snapshot release, skipping all validations and without publishing any artifacts (implies --skip-publish, --skip-announce and --skip-validate)
else
echo "Getting ready to publish"
goreleaser release \
--clean \
--release-notes="${RELEASE_NOTES_FILE}"
--config goreleaser.yaml
fi
6 changes: 0 additions & 6 deletions hack/release-tools/goreleaser.yaml

This file was deleted.

0 comments on commit 14f31ee

Please sign in to comment.