Merge branch 'main' of https://github.com/co-cddo/mta-sts-template #11
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
name: Configure and maintain the repo | |
on: [push] | |
permissions: write-all | |
jobs: | |
configure: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# by default, it uses a depth of 1 | |
# this fetches all history so that we can read each commit | |
fetch-depth: 0 | |
ref: ${{ github.head_ref }} | |
- run: | | |
echo "REPOSITORY_NAME=$( | |
echo '${{ github.repository }}' \ | |
| awk -F '/' '{print $2}' \ | |
| tr '-' '_' \ | |
| tr '[:upper:]' '[:lower:]' \ | |
)" >> $GITHUB_ENV | |
- run: | | |
echo "REPOSITORY_URLNAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV | |
- run: | | |
echo "REPOSITORY_OWNER=$(echo '${{ github.repository }}' | awk -F '/' '{print $1}')" >> $GITHUB_ENV | |
- run: | | |
if [ "$REPOSITORY_NAME" == "mta_sts_template" ]; then | |
echo "IS_TEMPLATE=true" >> $GITHUB_ENV | |
else | |
echo "IS_TEMPLATE=$(ls .github/template.yml &> /dev/null && echo true || echo false)" >> $GITHUB_ENV | |
fi | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Test configuration | |
if: env.IS_TEMPLATE == 'true' | |
working-directory: bin/ | |
run: | | |
echo "Repo owner: ${{ env.REPOSITORY_OWNER }}" | |
echo "Repo name: ${{ env.REPOSITORY_NAME }}" | |
echo "Repo URL: ${{ env.REPOSITORY_URLNAME }}" | |
echo "Template: ${{ env.IS_TEMPLATE }}" | |
python -m pip install -r requirements.txt | |
export SKIP_TLS_CHECK="False" | |
export MTASTS_DOMAIN="digital.cabinet-office.gov.uk" | |
python configure.py | |
cat ../CNAME | |
cat ../.well-known/* | |
- name: Push changes | |
if: env.IS_TEMPLATE != 'true' | |
working-directory: bin/ | |
run: | | |
echo "Would push changes..." |