-
Notifications
You must be signed in to change notification settings - Fork 548
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1802 from cpunion/check-goreleaser
Check goreleaser file lists
- Loading branch information
Showing
5 changed files
with
172 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import os | ||
import subprocess | ||
import yaml | ||
|
||
files = [f for f in os.listdir('.') if not f.startswith( | ||
".") and f not in ["VERSION"]] | ||
files.sort() | ||
# filter out the files that are ignored by git | ||
files = [f for f in files if subprocess.call( | ||
["git", "ls-files", "--error-unmatch", f], | ||
stdout=subprocess.DEVNULL, | ||
stderr=subprocess.DEVNULL) == 0] | ||
|
||
gorel = yaml.load(open(".goreleaser.yaml", "r"), Loader=yaml.FullLoader) | ||
scfiles = [f["source"] for f in gorel["snapcrafts"][0]["extra_files"]] | ||
scfiles.sort() | ||
|
||
failed = False | ||
|
||
if files != scfiles: | ||
failed = True | ||
print("Files in snapcraft are different from the ones in the repo") | ||
print("Update .goreleaser.yaml in the snapcraft section:") | ||
for f in files: | ||
print(f" - source: \"{f}\"") | ||
print(f" destination: \"{f}\"") | ||
|
||
nfpms_files = [f["src"] | ||
for f in gorel["nfpms"][0]["contents"] if f.get("type") != "symlink"] | ||
nfpms_files.sort() | ||
|
||
if files != nfpms_files: | ||
failed = True | ||
print("Files in nfpms are different from the ones in the repo") | ||
print("Update .goreleaser.yaml in the nfpms section:") | ||
for f in files: | ||
print(f" - src: \"{f}\"") | ||
print(f" dst: \"/usr/lib/{{{{ .ProjectName }}}}/{f}\"") | ||
|
||
if failed: | ||
exit(1) | ||
|
||
print(".goreleaser checks passed") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,11 @@ jobs: | |
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Check goreleaser files | ||
run: | | ||
pip install --no-input pyyaml | ||
python .github/workflows/check_goreleaser_config.py | ||
- name: Install Snapcraft | ||
uses: samuelmeuli/action-snapcraft@v2 | ||
|
@@ -64,7 +69,7 @@ jobs: | |
- name: Upload deb/rpm to Fury.io | ||
if: env.IS_PRERELEASE != 'true' | ||
run: | | ||
for file in dist/*.{deb,rpm} | ||
for file in .dist/*.{deb,rpm} | ||
do | ||
echo "Uploading $file to Fury.io" | ||
CODE=`curl --write-out '%{http_code}' --output /dev/null -sS -F package=@$file https://[email protected]/$GITHUB_REPOSITORY_OWNER/` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,4 +50,4 @@ bin/ | |
go-num/ | ||
_todo*.go | ||
|
||
dist/ | ||
.dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters