Skip to content

Commit

Permalink
Add changlog releaser. Update changelog. Update docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
funkyshu committed Feb 19, 2025
1 parent 08793db commit dc4af3f
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 34 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/ensure_changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CHANGELOG.md Check
on:
pull_request:
branches:
- main
jobs:
verify_changelog_job:
runs-on: ubuntu-latest
name: Did CHANGELOG.md change?
steps:
- name: checkout
uses: actions/checkout@v4
- name: fetch
run: git fetch
- name: run changelog.sh
run: 'bash ${GITHUB_WORKSPACE}/.github/workflows/scripts/changelog.sh'
3 changes: 0 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Go

on:
push:
branches:
- main
pull_request:
branches:
- main
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
name: golangci-lint
on:
push:
tags:
- v*
branches:
- main
pull_request:
jobs:
golangci:
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/release-by-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release by Changelog

on:
push:
branches:
- main
workflow_dispatch:
inputs:
branch:
description: 'Branch to create a release from'
required: true
default: 'main'
version:
description: 'Specify the semantic version for the release (vX.Y.Z)'
required: true
reason:
description: 'Reason for the manual release'
required: false

jobs:
release:
runs-on: ubuntu-latest

env:
GOPROXY: proxy.golang.org,direct
GOPRIVATE: github.com/c2fo,github.com/C2FO
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref_name }}
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24

- name: Install and run ReleaseGen
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_REF_NAME: ${{ github.event.inputs.branch || github.ref_name }}
MANUAL_VERSION: ${{ github.event.inputs.version || '' }}
REASON: ${{ github.event.inputs.reason || '' }}
CUSTOM_CHANGE_TYPES: |
documentation:patch
run: |
git config --global url."https://c2fo-read-only:${{ secrets.GH_CI_READ }}@github.com/c2fo".insteadOf "https://github.com/c2fo"
go install github.com/c2fo/ep-tools/releasegen@latest
releasegen
36 changes: 36 additions & 0 deletions .github/workflows/scripts/changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Find all directories containing a CHANGELOG.md file
changelogDirs=$(find . -type f -name 'CHANGELOG.md' -exec dirname {} \;)

# Check each directory for changes and ensure CHANGELOG.md is updated
for dir in $changelogDirs; do
echo "Checking directory: $dir"

# Check if there are any changes in the directory
dirChanges=$(git --no-pager diff -w --numstat origin/main -- $dir | wc -l)
if [[ "$dirChanges" -gt 0 ]]; then
echo "Changes detected in $dir"

# Check if CHANGELOG.md has been modified
changelogMod=$(git --no-pager diff -w --numstat origin/main -- $dir/CHANGELOG.md)
if [[ -z "$changelogMod" ]]; then
echo "CHANGELOG.md in $dir has not been modified. Please update it with your changes before merging to main."
exit 1
else
echo "CHANGELOG.md in $dir has been modified. Verifying at least 1 (non-whitespace) line has been added."
changelogLines=$(echo "$changelogMod" | awk '{print $1}')
if [[ "$changelogLines" -lt 1 ]]; then
echo "Didn't detect any substantial changes to CHANGELOG.md in $dir."
exit 1
else
echo "Detected '$changelogLines' new non-whitespace lines in CHANGELOG.md in $dir. Thanks +1"
fi
fi
else
echo "No changes detected in $dir"
fi
done

echo "All directories with changes have updated CHANGELOG.md files."
exit 0
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- Add support for role based authentication in s3 backend.
- Changelog-based release generation(releasegen).

### Security
- Update dependencies
- Update go to 1.23 from 1.22 (1.24 is out now)

### Documentation
- Update README.md with go version policy

## [6.25.1] - 2025-01-09
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion License.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019-2021 C2FO, Inc
Copyright (c) 2019-2025 C2FO, Inc

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
21 changes: 2 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,25 +166,8 @@ Things to add:
* Provide better List() functionality with more abstracted filtering and paging (iterator?) Return File structs vs URIs?
* Add better/any context.Context() support

### Contributors

Brought to you by the Enterprise Pipeline team at C2FO:

* John Judd - [email protected]

* Dustin Schnee - [email protected]

* Katie Hrenchir Shields - [email protected]

* Grant Higgins - [email protected]

* Pooja Dhondge - [email protected]

* Chris Roush – [email protected]

* Anthony Ross - [email protected]

https://github.com/c2fo/
### Supported Go Versions
This project supports the latest and previous major Go versions. Please ensure you are using one of these versions to avoid compatibility issues.

### Contributing

Expand Down
4 changes: 2 additions & 2 deletions backend/mem/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ func (s *memFileTest) TestCopyToLocationOS() {
s.NoError(copiedFile.Close(), "unexpected Close error")

s.NotNil(copiedFile)
s.Equal("/test_files/test.txt", s.testFile.Path()) // testFile's path should be unchanged
s.Equal("/test_files/test.txt", s.testFile.Path()) // testFile's path should be unchanged
s.Equal(path.Join(osFile.Location().Path(), "test.txt"), copiedFile.Path()) // new path should be that

_, err = copiedFile.Read(readSlice)
Expand All @@ -391,7 +391,7 @@ func (s *memFileTest) TestCopyToLocationOS() {
s.NoError(err, "unexpected read error")
s.Equal(readSlice2, readSlice) // both reads should be the same
s.Require().NoError(copiedFile.Close())
cleanErr := os.RemoveAll(dir) // clean up
cleanErr := os.RemoveAll(dir) // clean up
s.NoError(cleanErr, "unexpected error cleaning up osFiles")
}

Expand Down
2 changes: 1 addition & 1 deletion backend/s3/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ func (f *File) getHeadObject() (*s3.HeadObjectOutput, error) {
}

// For copy from S3-to-S3 when credentials are the same between source and target, return *s3.CopyObjectInput or error
func (f *File) getCopyObjectInput(targetFile *File) (*s3.CopyObjectInput, error) {
func (f *File) getCopyObjectInput(targetFile *File) (*s3.CopyObjectInput, error) { //nolint:gocyclo
// first we must determine if we're using the same s3 credentials for source and target before doing a native copy
isSameAccount := false
var ACL string
Expand Down

0 comments on commit dc4af3f

Please sign in to comment.