Skip to content

Commit f0d2949

Browse files
committed
Add workflows for CI, and for regenerating
1 parent baace41 commit f0d2949

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
on:
2+
pull_request:
3+
push:
4+
branches: [main]
5+
6+
jobs:
7+
success:
8+
name: Build
9+
runs-on: ubuntu-latest
10+
permissions:
11+
id-token: "write"
12+
contents: "read"
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: ./.
16+
- run: nix develop -c typos
17+
if: success() || failure()
18+
- run: nix develop -c ruff check
19+
if: success() || failure()
20+
- run: nix develop -c ruff format --diff
21+
if: success() || failure()
22+
- run: nix develop -c shellcheck ./tools/*.sh
23+
if: success() || failure()
24+
- name: Regenerate the README to make sure it is unchanged
25+
run: nix develop -c ./tools/generate.sh
26+
if: success() || failure()
27+
- name: Assert no changes were made
28+
run: git diff --exit-code
29+
if: success() || failure()
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
on:
2+
workflow_dispatch:
3+
inputs:
4+
reference-id:
5+
type: string
6+
required: true
7+
version:
8+
type: string
9+
required: true
10+
11+
concurrency:
12+
group: ${{ github.workflow }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
propose-release:
17+
uses: DeterminateSystems/propose-release/.github/workflows/workflow.yml@main
18+
permissions:
19+
id-token: "write"
20+
contents: "write"
21+
pull-requests: write
22+
with:
23+
reference-id: ${{ inputs.reference-id }}
24+
version: ${{ inputs.version }}
25+
extra-commands-early: |
26+
nix develop -c ./tools/update-state.sh "v$VERSION"
27+
git diff || true
28+
git commit -m "Update the state.json for v$VERSION" ./tools/state.json
29+
nix develop -c ./tools/generate.sh
30+
git commit -m "Update README.md and action.yml for v$VERSION" README.md action.yml
31+
echo "Checking there is no remaining diff..."
32+
git diff --exit-code

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
on:
2+
release:
3+
types:
4+
- released
5+
6+
jobs:
7+
PushLooseTag:
8+
environment: production
9+
permissions:
10+
id-token: write
11+
contents: write
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Optionally tag a vMAJOR tag
15+
id: check_tag
16+
env:
17+
VERSION: ${{ github.ref_name }}
18+
run: |
19+
if ! echo "$VERSION" | grep -q "^v[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+$"; then
20+
echo "version needs to be a version, in x.y.z format."
21+
echo "Therefore, not pushing a v<short>"
22+
exit 0
23+
fi
24+
25+
shorttag=$(echo "$VERSION" | cut -d'.' -f1)
26+
echo "shorttag=$shorttag" >> "$GITHUB_OUTPUT"
27+
28+
- uses: actions/checkout@v4
29+
- name: Create the short tag
30+
env:
31+
SHORTTAG: ${{ steps.check_tag.outputs.shorttag }}
32+
run: |
33+
git tag --force "$SHORTTAG"
34+
git push --force origin "$SHORTTAG"

0 commit comments

Comments
 (0)