Skip to content

Commit 2c4a057

Browse files
committed
Harden release publishing and add CodeQL
1 parent b20e5a7 commit 2c4a057

2 files changed

Lines changed: 85 additions & 4 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
schedule:
11+
- cron: "21 4 * * 1"
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
analyze:
19+
name: CodeQL (${{ matrix.language }})
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 15
22+
permissions:
23+
actions: read
24+
contents: read
25+
security-events: write
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
language:
30+
- python
31+
- javascript-typescript
32+
steps:
33+
- name: Check out repository
34+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
35+
with:
36+
persist-credentials: false
37+
38+
- name: Initialize CodeQL
39+
uses: github/codeql-action/init@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
40+
with:
41+
languages: ${{ matrix.language }}
42+
queries: security-extended
43+
44+
- name: Analyze
45+
uses: github/codeql-action/analyze@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
46+
with:
47+
category: "/language:${{ matrix.language }}"

.github/workflows/release.yml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@ on:
66
- "v*.*.*"
77

88
permissions:
9-
contents: write
9+
contents: read
1010

1111
jobs:
12-
release:
13-
name: Build immutable release
12+
build:
13+
name: Build and validate release
1414
runs-on: ubuntu-latest
1515
timeout-minutes: 15
16+
permissions:
17+
contents: read
1618
steps:
1719
- name: Check out tagged commit
1820
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
21+
with:
22+
persist-credentials: false
1923

2024
- name: Set up Python
2125
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
@@ -52,10 +56,40 @@ jobs:
5256
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
5357
with:
5458
name: "Italian_Cities-${{ github.ref_name }}"
55-
path: "dist/${{ github.ref_name }}/*"
59+
path: "dist/${{ github.ref_name }}/"
5660
if-no-files-found: error
5761
retention-days: 30
5862

63+
publish:
64+
name: Attest and publish release
65+
needs: build
66+
runs-on: ubuntu-latest
67+
timeout-minutes: 10
68+
permissions:
69+
attestations: write
70+
contents: write
71+
id-token: write
72+
steps:
73+
- name: Check out release metadata
74+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
75+
with:
76+
persist-credentials: false
77+
78+
- name: Download validated release package
79+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
80+
with:
81+
name: "Italian_Cities-${{ github.ref_name }}"
82+
path: "dist/${{ github.ref_name }}"
83+
84+
- name: Verify release checksums
85+
working-directory: "dist/${{ github.ref_name }}"
86+
run: shasum -a 256 -c SHA256SUMS
87+
88+
- name: Attest release assets
89+
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
90+
with:
91+
subject-path: "dist/${{ github.ref_name }}/*"
92+
5993
- name: Refuse to overwrite an existing release
6094
env:
6195
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)