diff --git a/.github/workflows/_create-pr-to-branch.yml b/.github/workflows/_create-pr-to-branch.yml new file mode 100644 index 00000000..11dada0e --- /dev/null +++ b/.github/workflows/_create-pr-to-branch.yml @@ -0,0 +1,45 @@ +name: Create pull request to branch + +on: + workflow_call: + inputs: + head: + type: string + default: ${{ github.ref_name }} + base: + required: true + type: string + +env: + GH_TOKEN: ${{ github.token }} + HEAD: ${{ inputs.head }} + BASE: ${{ inputs.base }} + +jobs: + create-pr: + runs-on: ubuntu-latest + outputs: + pr_number: ${{ steps.pr-number.outputs.pull_request_number }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Check for existing PR + id: check-pr + run: | + PR=$(gh pr list --base ${BASE} --head ${HEAD} --json number --jq '.[0].number') + echo "::set-output name=pr_exists::$PR" + + - name: Create pull request + if: steps.check-pr.outputs.pr_exists == '' + run: | + gh pr create \ + --label "autogenerated" \ + --base ${BASE} --head ${HEAD} \ + --title "Deploy to ${BASE}" \ + --body "Automated PR to sync changes from ${HEAD} to ${BASE}." + + - name: Get pull request number + id: pr-number + run: echo "pull_request_number=$(gh pr view --json number -q .number || echo "")" >> $GITHUB_OUTPUT diff --git a/.github/workflows/create-pr-to-staging.yml b/.github/workflows/create-pr-to-staging.yml new file mode 100644 index 00000000..5a04bea4 --- /dev/null +++ b/.github/workflows/create-pr-to-staging.yml @@ -0,0 +1,13 @@ +name: Create PR from main to staging + +on: + push: + branches: + - main + +jobs: + create-pr-to-staging: + uses: ./.github/workflows/_create-pr-to-branch.yml + secrets: inherit + with: + base: staging diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ee21cb6d..d95981f8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,14 +4,9 @@ on: push: branches: - main - tags: - staging workflow_dispatch: -env: - TAG_NAME: ${{ github.ref_name }} - REGISTRY: ghcr.io/gsa-tts/atj-platform - jobs: build-image-doj: uses: ./.github/workflows/_build-docker-image.yml diff --git a/README.md b/README.md index 5a103777..52027130 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ The project dependencies within the workspace are: Additional documentation: - [Architectural Decision Records (ADRs)](./documents/adr/) -- [Non-project contributions](./documents/value-created-log.md) +- [Release process](./documents/release-process.md) ## Overview diff --git a/documents/release-process.md b/documents/release-process.md new file mode 100644 index 00000000..729dc1b1 --- /dev/null +++ b/documents/release-process.md @@ -0,0 +1,14 @@ +# Release process + +There are currently two environments: + +- `main` (dev, main branch, CI/CD) +- `staging` (manually deployed via a release tag) + +## Overview + +To promote continuous integration, the 10x Forms Platform uses trunk-based development. In trunk-based development, we collaborate on code in a single, mainline branch. + +Deployments are managed by Terraform CDK. On merge to main, the [../.github/workflows/deploy.yml](../.github/workflows/deploy.yml) Github Action workflow builds Docker images for each app in the repository, pushes them to [ghcr.io](https://github.com/orgs/GSA-TTS/packages?repo_name=atj-platform), and deploys to the dev environment (`gsa-tts-10x-atj-dev`). + +When commits are made to main, the [../.github/workflows/create-pr-to-staging.yml](../.github/workflows/create-pr-to-staging.yml) workflow creates a PR to deploy to the staging environment, if it doesn't already exist. diff --git a/documents/value-created-log.md b/documents/value-created-log.md deleted file mode 100644 index fd0ed553..00000000 --- a/documents/value-created-log.md +++ /dev/null @@ -1,5 +0,0 @@ -# Value created - -The project team aims to stack the value it creates throughout the development of this project by improving the federal forms landscape wherever possible. This document lists notable contributions made by the project team to other efforts. - -- [uswds-compile PR#76](https://github.com/uswds/uswds-compile/pull/76) updates [uswds-compile](https://github.com/uswds/uswds-compile) to be compatible with alternate package managers, such as [pnpm](https://pnpm.io/).