Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions .github/workflows/release-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: Release (Manual)

on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., v1.0.0)'
required: true
type: string
draft:
description: 'Create as draft release'
required: false
type: boolean
default: true

permissions: read-all

jobs:
validate:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
version: ${{ steps.validate.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Validate version format
id: validate
run: |
VERSION="${{ github.event.inputs.version }}"

# Check version format
if ! [[ "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\.\-]+)?(\+[a-zA-Z0-9\.\-]+)?$ ]]; then
echo "❌ Invalid version format: $VERSION"
echo "Version must follow semantic versioning: vMAJOR.MINOR.PATCH[-PRERELEASE][+BUILD]"
exit 1
fi

# Check if tag already exists
if git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "❌ Tag $VERSION already exists"
exit 1
fi

echo "✅ Version $VERSION is valid"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

test:
needs: validate
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: '1.24.3'
cache: true

- name: Run tests
run: make test

- name: Run audit
run: make audit

release:
needs: [validate, test]
runs-on: ubuntu-latest
environment: release
permissions:
contents: write # To create releases and tags
packages: write # To push container images (if needed)
id-token: write # For cosign signing
outputs:
hashes: ${{ steps.hash.outputs.hashes }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: '1.24.3'
cache: true

- name: Install cosign
uses: sigstore/cosign-installer@3454372f43399081ed03b604cb2d021dabca52bb # v3.8.2

- name: Install syft
uses: anchore/sbom-action/download-syft@fc46e51fd3cb168ffb36c6d1915723c47db58abb # v0.17.7

- name: Create and push tag
run: |
VERSION="${{ needs.validate.outputs.version }}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

# Create annotated tag
git tag -a "$VERSION" -m "Release $VERSION"
git push origin "$VERSION"

- name: Run GoReleaser
id: goreleaser
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0
with:
version: v2.9.0
args: release --clean ${{ github.event.inputs.draft == 'true' && '--draft' || '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Generate subject for provenance
id: hash
env:
ARTIFACTS: "${{ steps.goreleaser.outputs.artifacts }}"
run: |
set -euo pipefail

# Parse artifacts JSON to extract checksums
checksum_file=$(echo "$ARTIFACTS" | jq -r '.[] | select (.type=="Checksum") | .path')

# Generate base64-encoded checksums for SLSA provenance
echo "hashes=$(cat $checksum_file | base64 -w0)" >> "$GITHUB_OUTPUT"

provenance:
needs: [release]
permissions:
actions: read # To read the workflow path
id-token: write # To sign the provenance
contents: write # To add assets to a release
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@f7dd8c54c2067bafc12ca7a55595d5ee9b75204a # v2.1.0
with:
base64-subjects: "${{ needs.release.outputs.hashes }}"
upload-assets: true
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release (Automated)

# This workflow is triggered by tags created by the release-manual workflow
# Direct tag pushes should be prevented by branch/tag protection rules
on:
push:
tags:
- 'v*'

permissions: read-all

jobs:
goreleaser:
runs-on: ubuntu-latest
permissions:
contents: write # To create releases
packages: write # To push container images (if needed)
id-token: write # For cosign signing
outputs:
hashes: ${{ steps.hash.outputs.hashes }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: '1.24.3'
cache: true

- name: Install cosign
uses: sigstore/cosign-installer@3454372f43399081ed03b604cb2d021dabca52bb # v3.8.2

- name: Run GoReleaser
id: goreleaser
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0
with:
version: v2
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Generate subject for provenance
id: hash
env:
ARTIFACTS: "${{ steps.goreleaser.outputs.artifacts }}"
run: |
set -euo pipefail

# Parse artifacts JSON to extract checksums
checksum_file=$(echo "$ARTIFACTS" | jq -r '.[] | select (.type=="Checksum") | .path')

# Generate base64-encoded checksums for SLSA provenance
echo "hashes=$(cat $checksum_file | base64 -w0)" >> "$GITHUB_OUTPUT"

provenance:
needs: [goreleaser]
permissions:
actions: read # To read the workflow path
id-token: write # To sign the provenance
contents: write # To add assets to a release
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@f7dd8c54c2067bafc12ca7a55595d5ee9b75204a # v2.1.0
with:
base64-subjects: "${{ needs.goreleaser.outputs.hashes }}"
upload-assets: true
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: CI Workflow
name: Test

on:
pull_request:
branches:
- develop
- master

permissions: read-all
Expand All @@ -18,7 +17,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ matrix.go-version }}
cache: true
Expand Down
78 changes: 74 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ builds:
- -X main.BuildTime={{ .Date }}

archives:
- formats: [tar.gz]
- formats: ["tar.gz"]
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
Expand All @@ -25,24 +25,94 @@ archives:
{{- if .Arm }}v{{ .Arm }}{{ end }}
format_overrides:
- goos: windows
formats: [zip]
formats: ["zip"]

checksum:
name_template: "{{ .ProjectName }}_checksums.txt"
algorithm: sha256

signs:
- cmd: cosign
env:
- COSIGN_EXPERIMENTAL=1
certificate: '${artifact}.pem'
args:
- sign-blob
- '--output-certificate=${certificate}'
- '--output-signature=${signature}'
- '${artifact}'
- "--yes" # needed on cosign 2.0.0+
artifacts: checksum
output: true

sboms:
- artifacts: archive
id: sboms

changelog:
sort: asc
use: github
groups:
- title: "✨ Features"
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
order: 0
- title: "🐛 Bug Fixes"
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
order: 1
- title: "📚 Documentation"
regexp: '^.*?docs(\([[:word:]]+\))??!?:.+$'
order: 2
- title: "🧪 Testing"
regexp: '^.*?test(\([[:word:]]+\))??!?:.+$'
order: 3
- title: "🔧 Other Changes"
order: 999
filters:
exclude:
- "^docs:"
- "^test:"
- "^chore:"
- "^ci:"
- "^build\\(deps\\):"

release:
github:
owner: jakec-dev
name: aws-local-sync

draft: true
replace_existing_draft: true

prerelease: auto

name_template: "{{ .ProjectName }} {{ .Tag }}"

header: |
## AWS Local Sync {{ .Tag }}

High-performance CLI tool that syncs data from AWS services (RDS, DynamoDB, S3, Elasticsearch, etc.) to your local development environment.

### Highlights

footer: |

---

### Installation

#### Binary installation
```bash
# Download and extract (example for Linux x86_64)
curl -sSL https://github.com/jakec-dev/aws-local-sync/releases/download/{{ .Tag }}/aws-local-sync_Linux_x86_64.tar.gz | tar xz

# Verify checksum signature
cosign verify-blob \
--certificate aws-local-sync_checksums.txt.pem \
--signature aws-local-sync_checksums.txt.sig \
aws-local-sync_checksums.txt
```

#### Go installation
```bash
go install github.com/jakec-dev/aws-local-sync/cmd/aws-local-sync@{{ .Tag }}
```

**Full Changelog**: https://github.com/jakec-dev/aws-local-sync/compare/{{ .PreviousTag }}...{{ .Tag }}
Loading
Loading