Merge pull request #323 from bnema/ci/dx-next-nongo-paths
ci: cover next branch and release paths
2 files · +75 -1
M .github/workflows/ci.yml +6 -1
| @@ -5,7 +5,7 @@ permissions: | |||
| 5 | 5 | ||
| 6 | 6 | on: | |
| 7 | 7 | push: | |
| 8 | - | branches: [main] | |
| 8 | + | branches: [main, next] | |
| 9 | 9 | paths: | |
| 10 | 10 | - '**.go' | |
| 11 | 11 | - 'go.mod' | |
| @@ -20,6 +20,10 @@ on: | |||
| 20 | 20 | jobs: | |
| 21 | 21 | changes: | |
| 22 | 22 | runs-on: ubuntu-latest | |
| 23 | + | permissions: | |
| 24 | + | contents: read | |
| 25 | + | # dorny/paths-filter uses PR metadata to compute changed files. | |
| 26 | + | pull-requests: read | |
| 23 | 27 | outputs: | |
| 24 | 28 | ci: ${{ steps.filter.outputs.ci }} | |
| 25 | 29 | steps: | |
| @@ -29,6 +33,7 @@ jobs: | |||
| 29 | 33 | - uses: dorny/paths-filter@v4 | |
| 30 | 34 | id: filter | |
| 31 | 35 | with: | |
| 36 | + | base: ${{ github.event_name == 'push' && github.ref_name || '' }} | |
| 32 | 37 | filters: | | |
| 33 | 38 | ci: | |
| 34 | 39 | - '**.go' | |
| @@ -5,7 +5,7 @@ permissions: | |||||
| 5 | 5 | ||||
| 6 | on: | 6 | on: | ||
| 7 | push: | 7 | push: | ||
| 8 | - | branches: [main] | 8 | + | branches: [main, next] |
| 9 | paths: | 9 | paths: | ||
| 10 | - '**.go' | 10 | - '**.go' | ||
| 11 | - 'go.mod' | 11 | - 'go.mod' | ||
| @@ -20,6 +20,10 @@ on: | |||||
| 20 | jobs: | 20 | jobs: | ||
| 21 | changes: | 21 | changes: | ||
| 22 | runs-on: ubuntu-latest | 22 | runs-on: ubuntu-latest | ||
| 23 | + | permissions: | |||
| 24 | + | contents: read | |||
| 25 | + | # dorny/paths-filter uses PR metadata to compute changed files. | |||
| 26 | + | pull-requests: read | |||
| 23 | outputs: | 27 | outputs: | ||
| 24 | ci: ${{ steps.filter.outputs.ci }} | 28 | ci: ${{ steps.filter.outputs.ci }} | ||
| 25 | steps: | 29 | steps: | ||
| @@ -29,6 +33,7 @@ jobs: | |||||
| 29 | - uses: dorny/paths-filter@v4 | 33 | - uses: dorny/paths-filter@v4 | ||
| 30 | id: filter | 34 | id: filter | ||
| 31 | with: | 35 | with: | ||
| 36 | + | base: ${{ github.event_name == 'push' && github.ref_name || '' }} | |||
| 32 | filters: | | 37 | filters: | | ||
| 33 | ci: | 38 | ci: | ||
| 34 | - '**.go' | 39 | - '**.go' | ||
A .github/workflows/release-paths.yml +69 -0
| @@ -0,0 +1,69 @@ | |||
| 1 | + | name: Release Paths | |
| 2 | + | ||
| 3 | + | permissions: | |
| 4 | + | contents: read | |
| 5 | + | ||
| 6 | + | on: | |
| 7 | + | push: | |
| 8 | + | branches: [main, next] | |
| 9 | + | paths: | |
| 10 | + | - 'docs/**' | |
| 11 | + | - '*.md' | |
| 12 | + | - 'install.sh' | |
| 13 | + | - 'scripts/**' | |
| 14 | + | - 'flatpak/**' | |
| 15 | + | - 'aur/**' | |
| 16 | + | - '.goreleaser.yaml' | |
| 17 | + | - '.github/workflows/aur.yml' | |
| 18 | + | - '.github/workflows/release-paths.yml' | |
| 19 | + | pull_request: | |
| 20 | + | branches: [main, next] | |
| 21 | + | paths: | |
| 22 | + | - 'docs/**' | |
| 23 | + | - '*.md' | |
| 24 | + | - 'install.sh' | |
| 25 | + | - 'scripts/**' | |
| 26 | + | - 'flatpak/**' | |
| 27 | + | - 'aur/**' | |
| 28 | + | - '.goreleaser.yaml' | |
| 29 | + | - '.github/workflows/aur.yml' | |
| 30 | + | - '.github/workflows/release-paths.yml' | |
| 31 | + | ||
| 32 | + | jobs: | |
| 33 | + | validate: | |
| 34 | + | runs-on: ubuntu-latest | |
| 35 | + | concurrency: | |
| 36 | + | group: release-paths-${{ github.event.pull_request.number || github.ref }} | |
| 37 | + | cancel-in-progress: true | |
| 38 | + | steps: | |
| 39 | + | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| 40 | + | with: | |
| 41 | + | persist-credentials: false | |
| 42 | + | - name: Validate shell entrypoints | |
| 43 | + | run: | | |
| 44 | + | shopt -s nullglob globstar | |
| 45 | + | files=(install.sh scripts/**/*.sh aur/*/PKGBUILD) | |
| 46 | + | for f in "${files[@]}"; do | |
| 47 | + | bash -n "$f" | |
| 48 | + | done | |
| 49 | + | - name: Validate release YAML | |
| 50 | + | run: | | |
| 51 | + | ruby -e 'require "psych"; Psych.safe_load_file(".goreleaser.yaml", permitted_classes: [], aliases: true); puts "validated .goreleaser.yaml"' | |
| 52 | + | ruby -e 'require "psych"; Psych.safe_load_file(".github/workflows/aur.yml", permitted_classes: [], aliases: true); puts "validated .github/workflows/aur.yml"' | |
| 53 | + | ruby -e 'require "psych"; Psych.safe_load_file(".github/workflows/release-paths.yml", permitted_classes: [], aliases: true); puts "validated .github/workflows/release-paths.yml"' | |
| 54 | + | - name: Validate Flatpak metadata XML | |
| 55 | + | run: | | |
| 56 | + | python3 - <<'PY' | |
| 57 | + | from pathlib import Path | |
| 58 | + | import xml.etree.ElementTree as ET | |
| 59 | + | ||
| 60 | + | for path in Path('flatpak').glob('*.xml'): | |
| 61 | + | ET.parse(path) | |
| 62 | + | print(f'validated {path}') | |
| 63 | + | PY | |
| 64 | + | - name: Check docs and packaging conflict markers | |
| 65 | + | run: | | |
| 66 | + | if grep -RInE '^(<<<<<<<|>>>>>>>)([[:space:]].*)?$' *.md .goreleaser.yaml docs install.sh scripts flatpak aur; then | |
| 67 | + | echo 'Found conflict marker in docs or release-adjacent files' >&2 | |
| 68 | + | exit 1 | |
| 69 | + | fi | |
| @@ -0,0 +1,69 @@ | |||||
| 1 | + | name: Release Paths | |||
| 2 | + | ||||
| 3 | + | permissions: | |||
| 4 | + | contents: read | |||
| 5 | + | ||||
| 6 | + | on: | |||
| 7 | + | push: | |||
| 8 | + | branches: [main, next] | |||
| 9 | + | paths: | |||
| 10 | + | - 'docs/**' | |||
| 11 | + | - '*.md' | |||
| 12 | + | - 'install.sh' | |||
| 13 | + | - 'scripts/**' | |||
| 14 | + | - 'flatpak/**' | |||
| 15 | + | - 'aur/**' | |||
| 16 | + | - '.goreleaser.yaml' | |||
| 17 | + | - '.github/workflows/aur.yml' | |||
| 18 | + | - '.github/workflows/release-paths.yml' | |||
| 19 | + | pull_request: | |||
| 20 | + | branches: [main, next] | |||
| 21 | + | paths: | |||
| 22 | + | - 'docs/**' | |||
| 23 | + | - '*.md' | |||
| 24 | + | - 'install.sh' | |||
| 25 | + | - 'scripts/**' | |||
| 26 | + | - 'flatpak/**' | |||
| 27 | + | - 'aur/**' | |||
| 28 | + | - '.goreleaser.yaml' | |||
| 29 | + | - '.github/workflows/aur.yml' | |||
| 30 | + | - '.github/workflows/release-paths.yml' | |||
| 31 | + | ||||
| 32 | + | jobs: | |||
| 33 | + | validate: | |||
| 34 | + | runs-on: ubuntu-latest | |||
| 35 | + | concurrency: | |||
| 36 | + | group: release-paths-${{ github.event.pull_request.number || github.ref }} | |||
| 37 | + | cancel-in-progress: true | |||
| 38 | + | steps: | |||
| 39 | + | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |||
| 40 | + | with: | |||
| 41 | + | persist-credentials: false | |||
| 42 | + | - name: Validate shell entrypoints | |||
| 43 | + | run: | | |||
| 44 | + | shopt -s nullglob globstar | |||
| 45 | + | files=(install.sh scripts/**/*.sh aur/*/PKGBUILD) | |||
| 46 | + | for f in "${files[@]}"; do | |||
| 47 | + | bash -n "$f" | |||
| 48 | + | done | |||
| 49 | + | - name: Validate release YAML | |||
| 50 | + | run: | | |||
| 51 | + | ruby -e 'require "psych"; Psych.safe_load_file(".goreleaser.yaml", permitted_classes: [], aliases: true); puts "validated .goreleaser.yaml"' | |||
| 52 | + | ruby -e 'require "psych"; Psych.safe_load_file(".github/workflows/aur.yml", permitted_classes: [], aliases: true); puts "validated .github/workflows/aur.yml"' | |||
| 53 | + | ruby -e 'require "psych"; Psych.safe_load_file(".github/workflows/release-paths.yml", permitted_classes: [], aliases: true); puts "validated .github/workflows/release-paths.yml"' | |||
| 54 | + | - name: Validate Flatpak metadata XML | |||
| 55 | + | run: | | |||
| 56 | + | python3 - <<'PY' | |||
| 57 | + | from pathlib import Path | |||
| 58 | + | import xml.etree.ElementTree as ET | |||
| 59 | + | ||||
| 60 | + | for path in Path('flatpak').glob('*.xml'): | |||
| 61 | + | ET.parse(path) | |||
| 62 | + | print(f'validated {path}') | |||
| 63 | + | PY | |||
| 64 | + | - name: Check docs and packaging conflict markers | |||
| 65 | + | run: | | |||
| 66 | + | if grep -RInE '^(<<<<<<<|>>>>>>>)([[:space:]].*)?$' *.md .goreleaser.yaml docs install.sh scripts flatpak aur; then | |||
| 67 | + | echo 'Found conflict marker in docs or release-adjacent files' >&2 | |||
| 68 | + | exit 1 | |||
| 69 | + | fi | |||