Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
gordonfarrell committed Nov 8, 2023
1 parent 5a75621 commit 8d8029d
Showing 1 changed file with 7 additions and 135 deletions.
142 changes: 7 additions & 135 deletions .github/workflows/delete-me.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,134 +9,12 @@ on:

# Run all tests before making a release
jobs:
# Only make a release if commit contains [RELEASE]
check-commit-message:
runs-on: ubuntu-latest
outputs:
contains_release: ${{ steps.commit_check.outputs.contains_release }}
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Check commit message for [RELEASE]
id: commit_check
run: |
if [[ "${{ github.event.head_commit.message }}" == *"[RELEASE]"* ]]; then
echo "contains_release=true" >> $GITHUB_OUTPUT
else
echo "contains_release=false" >> $GITHUB_OUTPUT
fi
tag-release:
name: Update phdi init version number
permissions:
contents: write
outputs:
version: ${{ steps.get_version.outputs.version }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
ref: 'main'
- name: Install poetry and dependencies
run: |
pip install poetry
# update the version number in the phdi/__init.py__ file
- name: Get PHDI Version
id: get_version
run: |
VERSION_WITH_PHDI=$(poetry version)
echo "version=${VERSION_WITH_PHDI:5}" >> $GITHUB_OUTPUT
# Create new release tag
- name: Set up Git user
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Tag Release
uses: EndBug/latest-tag@latest
with:
ref: 1.1.99
# Generate release notes
- name: Generate release notes
id: release_notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
latest_release_date=$(gh api "/repos/$GITHUB_REPOSITORY/releases?per_page=1" | jq ".[0].created_at")
prs=$(gh pr list --base main --state closed --json title,number,url,closedAt -q ".[] | select(.closedAt > $latest_release_date) | select(.title | contains(\"RELEASE\") | not)")
echo "# Release Notes" > release-notes.md
echo "" >> release-notes.md
echo "" >> release-notes.md
while IFS= read -r pr; do
pr_title=$(echo "$pr" | jq -r ".title")
pr_number=$(echo "$pr" | jq -r ".number")
pr_url=$(echo "$pr" | jq -r ".url")
line_text="- $pr_title ([#$pr_number]($pr_url))"
echo $line_text >> release-notes.md
done < <(printf '%s' "$prs")
# Create new release based upon the latest created tag
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.version }}
release_name: ${{ steps.get_version.outputs.version }}
body_path: release-notes.md

# Rebuild all containers for the new release
build-containers-for-release:
needs:
- tag-release
permissions:
contents: read
packages: write
id-token: write
uses: ./.github/workflows/buildReleaseContainers.yaml
with:
container-tag: ${{ needs.tag-release.outputs.version }}

# Create updated PHDI docs for the latest release
generate-and-update-phdi-docs:
needs:
- tag-release
- build-containers-for-release
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
ref: ${{ needs.tag-release.outputs.version }}

- name: Install poetry and dependencies
run: |
pip install poetry
poetry install
- name: Generate docs and move to docs branch
run: |
poetry run pdoc ./phdi -o ./docs/${{ needs.tag-release.outputs.version }}/sdk
- uses: actions/upload-artifact@v3
with:
name: phdi-docs
path: ./docs/${{ needs.tag-release.outputs.version }}/sdk

# Create updated container docs for the latest release
list-containers:
if: ${{ needs.check-commit-message.outputs.contains_release == 'true' }}
uses: ./.github/workflows/listContainers.yaml
generate-and-update-container-docs:
needs:
- tag-release
- list-containers
- generate-and-update-phdi-docs
permissions:
contents: write
runs-on: ubuntu-latest
Expand All @@ -163,7 +41,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
ref: ${{ needs.tag-release.outputs.version }}
ref: 1.1.1.1

- name: Update Container Documenation
env:
Expand All @@ -181,12 +59,12 @@ jobs:
cp $GITHUB_WORKSPACE/utils/make_openapi_json.py .
pip install -r requirements.txt
python make_openapi_json.py
npx @redocly/cli build-docs $GITHUB_WORKSPACE/docs/${{ needs.tag-release.outputs.version }}/containers/$CONTAINER.html openapi.json
npx @redocly/cli build-docs $GITHUB_WORKSPACE/docs/1.1.1.1/containers/$CONTAINER.html openapi.json
- uses: actions/upload-artifact@v3
with:
name: container-docs
path: ./docs/${{ needs.tag-release.outputs.version }}/containers
path: ./docs/1.1.1.1/containers

commit-docs:
needs:
Expand All @@ -201,28 +79,22 @@ jobs:
with:
ref: docs

- name: Download phdi docs from artifacts
uses: actions/download-artifact@v2
with:
name: phdi-docs
path: ./docs/${{ needs.tag-release.outputs.version }}/sdk

- name: Download container docs from artifacts
uses: actions/download-artifact@v2
with:
name: container-docs
path: ./docs/${{ needs.tag-release.outputs.version }}/containers
path: ./docs/1.1.1.1/containers

- name: Copy to latest folder
run: |
rm -rf ./docs/latest
mkdir -p ./docs/latest/sdk
mkdir -p ./docs/latest/containers
cp -r ./docs/${{ needs.tag-release.outputs.version }}/sdk/* ./docs/latest/sdk
cp -r ./docs/${{ needs.tag-release.outputs.version }}/containers/* ./docs/latest/containers
cp -r ./docs/1.1.1.1/sdk/* ./docs/latest/sdk
cp -r ./docs/1.1.1.1/containers/* ./docs/latest/containers
- name: Commit New Documentation
uses: EndBug/add-and-commit@v9
with:
add: docs
message: Automated update of docs for ${{ needs.tag-release.outputs.version }} release.
message: Automated update of docs for 1.1.1.1 release.

0 comments on commit 8d8029d

Please sign in to comment.