Skip to content

Commit b9c9ec1

Browse files
committed
modernize github actions workflow and untangle it from ferrous
1 parent 3da913f commit b9c9ec1

File tree

2 files changed

+37
-49
lines changed

2 files changed

+37
-49
lines changed

.github/workflows/ci.yml

+37-34
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,23 @@
55

66
name: CI
77
on:
8-
push:
9-
branches: [staging, trying]
10-
pull_request: {}
8+
pull_request:
9+
merge_group:
1110

12-
permissions:
13-
contents: write
14-
pull-requests: write
15-
id-token: write
11+
# Defined at the job level.
12+
permissions: {}
1613

1714
jobs:
18-
ci:
19-
name: CI
15+
build:
16+
name: Build the documentation
2017
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
2120
steps:
22-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2322

2423
- name: Setup uv
25-
uses: astral-sh/setup-uv@v5
24+
uses: astral-sh/setup-uv@v6
2625

2726
- name: Build documentation and check links
2827
run: ./make.py --check-links
@@ -36,30 +35,34 @@ jobs:
3635
- name: Lint Python code with flake8
3736
run: uvx flake8 . --exclude .venv
3837

39-
- name: Publish to GitHub Pages
40-
uses: ferrous-systems/shared-github-actions/github-pages@main
38+
- name: Upload pages artifact
39+
uses: actions/upload-pages-artifact@v3
4140
with:
4241
path: build/html
43-
cname: spec.ferrocene.dev
44-
token: ${{ secrets.GITHUB_TOKEN }}
45-
if: github.event_name == 'push' && github.ref == 'refs/heads/staging'
4642

47-
- name: Authenticate with AWS
48-
uses: ferrous-systems/shared-github-actions/aws-oidc@main
49-
with:
50-
role: arn:aws:iam::886866542769:role/publish-specification-preview
51-
if: github.event_name == 'push' && github.ref == 'refs/heads/trying'
52-
53-
- name: Upload specification preview to AWS
54-
run: aws s3 cp --recursive build/html "s3://ferrocene-specification-preview/${GITHUB_SHA}"
55-
if: github.event_name == 'push' && github.ref == 'refs/heads/trying'
43+
deploy:
44+
name: Deploy to GitHub Pages
45+
runs-on: ubuntu-latest
46+
needs: [ build ]
47+
if: github.event_name == 'merge_group'
48+
permissions:
49+
pages: write
50+
id-token: write
51+
environment:
52+
name: github-pages
53+
url: ${{ steps.deployment.outputs.page_url }}
54+
steps:
55+
- name: Deploy to GitHub Pages
56+
uses: actions/deploy-pages@v4
57+
id: deployment
5658

57-
- name: Post comment in the PR with the preview link
58-
run: |
59-
# https://stackoverflow.com/a/66365284
60-
# Extract the PR number from the commit message, or return code 128
61-
pr="$(git show --format="%s" | head -n 1 | sed 's/^Try #\([0-9]\+\):.*$/\1/; t; q 128')"
62-
curl -X POST -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${pr}/comments -d "{\"body\": \"[Open the preview for this pull request!](https://ferrocene-specification-preview.s3.us-east-1.amazonaws.com/${GITHUB_SHA}/index.html)\"}"
63-
env:
64-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65-
if: github.event_name == 'push' && github.ref == 'refs/heads/trying'
59+
finished:
60+
name: CI finished
61+
runs-on: ubuntu-latest
62+
needs: [ build, deploy ]
63+
if: "${{ !cancelled() }}"
64+
env:
65+
NEEDS: "${{ toJson(needs) }}"
66+
steps:
67+
- name: Check if all jobs were successful or skipped
68+
run: echo "${NEEDS}" | jq --exit-status 'all(.result == "success" or .result == "skipped")'

bors.toml

-15
This file was deleted.

0 commit comments

Comments
 (0)