Fix broken link #790
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-License-Identifier: MIT OR Apache-2.0 | |
# SPDX-FileCopyrightText: Ferrous Systems and AdaCore | |
--- | |
name: CI | |
on: | |
push: | |
branches: [staging, trying] | |
pull_request: {} | |
permissions: | |
contents: write | |
pull-requests: write | |
id-token: write | |
jobs: | |
ci: | |
name: CI | |
# Ubuntu 22.04 does not support actions/setup-python with Python 3.6 as of | |
# 2022-11-24. See https://github.com/actions/setup-python/issues/544. | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
# Some Ferrocene builders require the use of Python 3.9. Use that on CI | |
# to make sure there are no surprises when we import into Ferrocene. | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: "3.9.x" | |
- name: Build documentation and check links | |
run: ./make.py --check-links | |
- name: Install Python dependencies | |
run: python3 -m pip install reuse black flake8 | |
- name: Verify licensing metadata | |
run: reuse lint | |
- name: Verify Python code formatting | |
run: black . --check --diff --color | |
- name: Lint Python code with flake8 | |
run: flake8 . --exclude .venv | |
- name: Publish to GitHub Pages | |
uses: ferrous-systems/shared-github-actions/github-pages@main | |
with: | |
path: build/html | |
cname: spec.ferrocene.dev | |
token: ${{ secrets.GITHUB_TOKEN }} | |
if: github.event_name == 'push' && github.ref == 'refs/heads/staging' | |
- name: Authenticate with AWS | |
uses: ferrous-systems/shared-github-actions/aws-oidc@main | |
with: | |
role: arn:aws:iam::886866542769:role/publish-specification-preview | |
if: github.event_name == 'push' && github.ref == 'refs/heads/trying' | |
- name: Upload specification preview to AWS | |
run: aws s3 cp --recursive build/html "s3://ferrocene-specification-preview/${GITHUB_SHA}" | |
if: github.event_name == 'push' && github.ref == 'refs/heads/trying' | |
- name: Post comment in the PR with the preview link | |
run: | | |
# https://stackoverflow.com/a/66365284 | |
# Extract the PR number from the commit message, or return code 128 | |
pr="$(git show --format="%s" | head -n 1 | sed 's/^Try #\([0-9]\+\):.*$/\1/; t; q 128')" | |
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)\"}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: github.event_name == 'push' && github.ref == 'refs/heads/trying' |