Skip to content

Commit

Permalink
Merge pull request #1 from NRLMMD-GEOIPS/v1.14.1-release
Browse files Browse the repository at this point in the history
v1.14.1 - geoips_ci - VERSION RELEASE - initial CI and sync
  • Loading branch information
mindyls authored Sep 30, 2024
2 parents fcd98ef + 5396faf commit 97aab4c
Show file tree
Hide file tree
Showing 32 changed files with 1,994 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .github/workflows/brassy-notes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Brassy

on:
# Triggers the workflow when pull request closed (either closed
# as non-planned, or actually approved and merged.)
pull_request:
types:
- closed
branch: main
# Allows run of this workflow manually from the Actions tab
# Must be merged to default before it will be available to manually run.
workflow_dispatch:

jobs:
brassy-notes:
name: Brassy
# You do not appear to be able to use variables in the "uses" field.
uses: NRLMMD-GEOIPS/geoips_ci/.github/workflows/reusable-brassy-notes.yaml@main
# Only run this if the pull request was merged, not just closed.
if: github.event.pull_request.merged == true
permissions:
contents: write
pull-requests: write
secrets:
token: ${{ secrets.GEOIPS_TOKEN }}
16 changes: 16 additions & 0 deletions .github/workflows/proper-release-note-edits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Note edits

# We only need to check status of release notes from pull requests.
on:
# Triggers the workflow when pull request created and updated
pull_request:
# Allows run of this workflow manually from the Actions tab
workflow_dispatch:

jobs:
note-edits:
name: Note edits
# You do not appear to be able to use variables in the "uses" field.
uses: NRLMMD-GEOIPS/geoips_ci/.github/workflows/[email protected]
permissions:
contents: read
124 changes: 124 additions & 0 deletions .github/workflows/reusable-brassy-notes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Brassy prep

# 1. Brassy - on PR merge of v*-version-release
# * move YAML release notes to correct version directories
# * commit and push to v*-finalize-release-notes
# * open PR to default branch
# 2. Tag and Release - on PR merge of v*-finalize-release-notes
# * Tag current version
# * Release just tagged version
# 3. Package and Publish - on published release (from #2)
# * Build wheel
# * Publish to pypi
# 4. Deploy docs - on published release (from #2)
# * pip install geoips
# * pip install plugin repo
# * build docs with geoips/docs/build_docs.sh
# * deploy docs with geoips/docs/deploy_pages.sh

on:
workflow_call:
secrets:
token:
required: true

# Assuming this is in the plugin repo's workflow file.
# on:
# workflow_dispatch:
# # Triggers the workflow when pull request created and updated
# pull_request:
# types:
# - closed
# branch: main

jobs:
check-release-branch:
name: Check release branch
uses: NRLMMD-GEOIPS/geoips_ci/.github/workflows/reusable-check-release-branch.yaml@main

get-versions:
name: Get versions
uses: NRLMMD-GEOIPS/geoips_ci/.github/workflows/reusable-get-versions.yaml@main
permissions:
contents: read
secrets:
token: ${{ secrets.token }}

print-variables:
name: Print variables
needs: [check-release-branch, get-versions]
# You do not appear to be able to use variables in this "uses" field.
uses: NRLMMD-GEOIPS/geoips_ci/.github/workflows/reusable-print-variables.yaml@main
with:
# These are outputs defined in the check-release-branch and get-versions
# reusable workflows. Explicitly pass them in here to track what
# variables we have available to this workflow.
IS_VERSION_RELEASE_BRANCH: ${{ needs.check-release-branch.outputs.IS_VERSION_RELEASE_BRANCH }}
IS_FINAL_RELEASE_BRANCH: ${{ needs.check-release-branch.outputs.IS_FINAL_RELEASE_BRANCH }}
TAGGED_VERSION: ${{ needs.get-versions.outputs.TAGGED_VERSION }}
UPCOMING_VERSION: ${{ needs.get-versions.outputs.UPCOMING_VERSION }}

move-release-notes:
runs-on: ${{ vars.RUNNER }}
name: Move release notes
needs: [check-release-branch, get-versions]
if: needs.check-release-branch.outputs.IS_VERSION_RELEASE_BRANCH == 'true'
permissions:
pull-requests: write
contents: write
steps:
- name: Checkout current plugin current branch
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.token }}
path: current_repo_current_branch

- name: Checkout geoips repo default branch
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: ${{ vars.GEOIPS_ORGANIZATION }}/geoips
ref: ${{ vars.GEOIPS_DEFAULT_BRANCH }}
token: ${{ secrets.token }}
path: geoips_repo_default_branch
github-server-url: ${{ vars.GEOIPS_SERVER_URL }}

- name: Compile new branch name
id: new_branch_name
run: |
new_branch_name=v${{needs.get-versions.outputs.TAGGED_VERSION}}-finalize-release-notes
echo "new_branch_name=${new_branch_name}"
echo "new_branch_name=${new_branch_name}" >> $GITHUB_OUTPUT
- name: Setup git enviorment
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'github-actions@${GITHUB_SERVER_URL/https:\/\//}'
git -C current_repo_current_branch checkout -b ${{ steps.new_branch_name.outputs.new_branch_name }}
- name: Move YAML latest directory to tagged version
run: |
git -C current_repo_current_branch mv docs/source/releases/latest/ docs/source/releases/${{ needs.get-versions.outputs.TAGGED_VERSION }}
if [[ -d current_repo_current_branch/docs/source/releases/upcoming/ ]]; then
git -C current_repo_current_branch mv docs/source/releases/upcoming/ docs/source/releases/latest
fi
git -C current_repo_current_branch commit -m "Move YAML release notes"
- name: Push moved YAML directory
run: |
git -C current_repo_current_branch push --set-upstream origin ${{ steps.new_branch_name.outputs.new_branch_name }}
- name: Create Pull Request
run: |
cd current_repo_current_branch
SERVER_URL=${GITHUB_SERVER_URL/https:\/\//}
echo ${{ secrets.token }} | gh auth login --hostname ${SERVER_URL} --with-token
gh label create "Version Release" --color "FF00FF" --force
gh pr create \
--base ${{ github.base_ref }} \
--label "Version Release" \
--head ${{ steps.new_branch_name.outputs.new_branch_name }} \
--title "${{ github.head_ref }} Merge updated release notes into ${{ github.base_ref }}" \
--body "Created by manually run GitHub action."
45 changes: 45 additions & 0 deletions .github/workflows/reusable-check-release-branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Check release branch

on:
workflow_call:
outputs:
IS_VERSION_RELEASE_BRANCH:
description: "Determine if the current branch is a version release branch"
value: ${{ jobs.check-release-branch.outputs.IS_VERSION_RELEASE_BRANCH}}
IS_FINAL_RELEASE_BRANCH:
description: "Determine if the current branch is a final release branch"
value: ${{ jobs.check-release-branch.outputs.IS_FINAL_RELEASE_BRANCH}}

jobs:
check-release-branch:
runs-on: ${{ vars.RUNNER }}
name: Check release branch
outputs:
# Note pull request merged does not propagate to reusable workflows
IS_VERSION_RELEASE_BRANCH: ${{ steps.id_release_branch.outputs.IS_VERSION_RELEASE_BRANCH }}
IS_FINAL_RELEASE_BRANCH: ${{ steps.id_release_branch.outputs.IS_FINAL_RELEASE_BRANCH }}
steps:
- name: Determine if this is an initial release branch
id: id_release_branch
run: |
echo "Head ref: ${GITHUB_HEAD_REF}"
echo "Base ref: ${GITHUB_BASE_REF}"
if [[ "${GITHUB_HEAD_REF}" =~ "v"*"-version-release" ]]; then
echo "IS_VERSION_RELEASE_BRANCH=true"
echo "IS_VERSION_RELEASE_BRANCH=true" >> $GITHUB_ENV
echo "IS_VERSION_RELEASE_BRANCH=true" >> $GITHUB_OUTPUT
else
echo "IS_VERSION_RELEASE_BRANCH=false"
echo "IS_VERSION_RELEASE_BRANCH=false" >> $GITHUB_ENV
echo "IS_VERSION_RELEASE_BRANCH=false" >> $GITHUB_OUTPUT
fi
if [[ "${GITHUB_HEAD_REF}" =~ "v"*"-finalize-release-notes" ]]; then
echo "IS_FINAL_RELEASE_BRANCH=true"
echo "IS_FINAL_RELEASE_BRANCH=true" >> $GITHUB_ENV
echo "IS_FINAL_RELEASE_BRANCH=true" >> $GITHUB_OUTPUT
else
echo "IS_FINAL_RELEASE_BRANCH=false"
echo "IS_FINAL_RELEASE_BRANCH=false" >> $GITHUB_ENV
echo "IS_FINAL_RELEASE_BRANCH=false" >> $GITHUB_OUTPUT
fi
Loading

0 comments on commit 97aab4c

Please sign in to comment.